From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH 1/2] alias -L: Emit aliases that begin with a plus sign correctly.
Date: Thu, 24 Nov 2016 06:57:51 +0000 [thread overview]
Message-ID: <1479970672-23682-1-git-send-email-danielsh@fujitsu.shahaf.local2> (raw)
---
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("-- ");
}
next reply other threads:[~2016-11-24 7:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 6:57 Daniel Shahaf [this message]
2016-11-24 6:57 ` [PATCH 2/2] builtins: Say 'bad option: +x', not 'bad option: -x', when +x was passed Daniel Shahaf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479970672-23682-1-git-send-email-danielsh@fujitsu.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).