Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Defining function based on alias
- X-seq: zsh-workers 40314
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: Defining function based on alias
- Date: Mon, 9 Jan 2017 01:55:53 +0000
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=Pkoykdp7UxiZCpk Qlr81d7qGu+E=; b=p1nw8TS8iSemQ+ja0WT80TBDb2eEHsB1VRz9IxHW5stwitG vZwD0kYypGTElpGzJggy7dR9YSzfUnWpqpVs9VnfAOOHTb5Xt0JF+S9kifpFXqkz 9uQZ2ZUkzHEEcH1b0qKi2SR2OSPlOeHb/Wc4YzhVrq6mboE7776bBE0KYcp8=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=Pkoykdp7UxiZCp kQlr81d7qGu+E=; b=hjfJoFcK6FWMALA4/tKGo7OsYJTk65k3p3RIehlSVcKylu Q+NrMCovZTl40gQQVE/62ZaJEl8omMVrA70kAHvSlFzzDChDOWry8Nxb8lAqYuLE OE/Hm77NARplrk+bgaMKjMGw+8DOwecyDquCpfHH0VUlclRoWvHewCauqJcIM=
- In-reply-to: <20170108191922.3d3de59f@ntlworld.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20170107221659.1b9232da@ntlworld.com> <20170108191922.3d3de59f@ntlworld.com>
Peter Stephenson wrote on Sun, Jan 08, 2017 at 19:19:22 +0000:
> +++ b/Src/input.c
> @@ -670,3 +670,22 @@ ingetptr(void)
> {
> return inbufptr;
> }
> +
> +/**/
> +char *input_hasalias(void)
May we please have docstrings for new code? E.g.,
/*
* If the input at the top of the stack(?) is an alias, return the name of
* that alias, otherwise return NULL.
*/
Gave this a quick spin with various aliases and global aliases; behaves
as I'd expect.
My main concern is that .zshrc files that contain such a bug will not be
sourced all the way through. Add a README entry?
Thanks,
Daniel
> +{
> + int flags = inbufflags;
> + struct instacks *instackptr = instacktop;
> +
> + for (;;)
> + {
> + if (!(flags & INP_CONT))
> + break;
> + instackptr--;
> + if (instackptr->alias)
> + return instackptr->alias->node.nam;
> + flags = instackptr->flags;
> + }
> +
> + return NULL;
> +}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author