Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 1/2] alias -L: Emit aliases that begin with a plus sign correctly.
- X-seq: zsh-workers 40009
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 1/2] alias -L: Emit aliases that begin with a plus sign correctly.
- Date: Thu, 24 Nov 2016 06:57:51 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=yKD FFaDM3r3xi+4gpGsIbw8+0SA=; b=YfyPrtw4KKaeJHdq6ZxdWEF4ZFw36In8cja zIq02yp1nsxN1kAuyJRatruy+reIxSWjZ0qBr7mo5x8xVGI0CC4UO6BYDr+tmG9w TW8/hB5Oc5frbATak1aR9Tisq/mPrTrj8jVBi+kloXj9BJmM726qVqmtjZJZqXuk Vdofmj2w=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=yK DFFaDM3r3xi+4gpGsIbw8+0SA=; b=KxW7NG4sfwyB+pXpsTYc5fZmBg9doWtP4k brMcAgz8dcDtEJC4ynsPtgbb22/zMV+g/QFJYhxx63sKU1EqGt+JGy2uIILUOm3k V3KmBaCrgxH065qjNsTDXSe7jOgtRHUodoO0Zc2gqJTw+1GBj1e/bA4+Myk8dWFE 8IZ/7d3A8=
- 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
---
Without this series:
% alias -- +foo=42
% alias -L
alias +foo=42
alias run-help=man
alias which-command=whence
% eval $(alias -L)
zsh: bad option: -f
Reported as z-sy-h issue #392.
Sideline: how to make the workflow
x=`alias -L`
unalias -m \*
...
eval $x
work under released versions, that have this bug?
This is for z-sy-h, so the ellipsis is sourced with user settings in effect,
and needs to change global state. Ideas so far are to define an 'alias'
function [but that would overwrite a user-defined function by that name]; to
use 'zcompile -U' or 'autoload -U' with a second file; or to somehow arrange
for aliases that begin with a '+' to be exempted from being undefined and from
being redefined.
Cheers,
Daniel
Src/hashtable.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Src/hashtable.c b/Src/hashtable.c
index 2d5af5b..7c33675 100644
--- a/Src/hashtable.c
+++ b/Src/hashtable.c
@@ -1291,9 +1291,9 @@ printaliasnode(HashNode hn, int printflags)
else if (a->node.flags & ALIAS_GLOBAL)
printf("-g ");
- /* If an alias begins with `-', then we must output `-- ' *
+ /* If an alias begins with `-' or `+', then we must output `-- '
* first, so that it is not interpreted as an option. */
- if(a->node.nam[0] == '-')
+ if(a->node.nam[0] == '-' || a->node.nam[0] == '+')
printf("-- ");
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author