zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] Fix unintentional history modifiers.
@ 2016-09-22 11:43 Daniel Shahaf
  2016-09-22 16:34 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2016-09-22 11:43 UTC (permalink / raw)
  To: zsh-workers

---
The _dates one worked even before this patch (!); I haven't investigated why.

Daniel

 Completion/Darwin/Type/_retrieve_mac_apps | 4 ++--
 Completion/Unix/Command/_dsh              | 2 +-
 Completion/Unix/Type/_dates               | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Completion/Darwin/Type/_retrieve_mac_apps b/Completion/Darwin/Type/_retrieve_mac_apps
index ba15577..f24d36c 100644
--- a/Completion/Darwin/Type/_retrieve_mac_apps
+++ b/Completion/Darwin/Type/_retrieve_mac_apps
@@ -71,7 +71,7 @@ _retrieve_mac_apps() {
 
     # Get application search method
     typeset retrieve
-    if ! zstyle -s ":completion:*:*:$service:commands" search-method retrieve
+    if ! zstyle -s ":completion:*:*:${service}:commands" search-method retrieve
     then
       if [[ -d /.Spotlight-V100 ]]; then
         # / is indexed to use Spotlight
@@ -80,7 +80,7 @@ _retrieve_mac_apps() {
         # Fall back to the old way
         retrieve=_mac_apps_old_retrieve 
       fi
-      zstyle ":completion:*:*:$service:commands" search-method $retrieve
+      zstyle ":completion:*:*:${service}:commands" search-method $retrieve
     fi
 
     # Get root directories to search applications
diff --git a/Completion/Unix/Command/_dsh b/Completion/Unix/Command/_dsh
index 8c5c232..fc76800 100644
--- a/Completion/Unix/Command/_dsh
+++ b/Completion/Unix/Command/_dsh
@@ -25,7 +25,7 @@ _arguments -s -C -S \
   '*::args: _normal' && return
 
 if [[ $state = groups ]]; then
-  if ! zstyle -s ":completion:$curcontext:dsh-groups" dsh-groups grp; then
+  if ! zstyle -s ":completion:${curcontext}:dsh-groups" dsh-groups grp; then
     [[ -e ~/.dsh/group ]] && grp="~/.dsh/group" || return 1
   fi
   _path_files -W ~/.dsh/group && return
diff --git a/Completion/Unix/Type/_dates b/Completion/Unix/Type/_dates
index e4fa62e..0af10eb 100644
--- a/Completion/Unix/Type/_dates
+++ b/Completion/Unix/Type/_dates
@@ -22,10 +22,10 @@ local future mlabel mfmt mlabels
 
 zparseopts -D -K -E f:=format F=future
 (( future = $#future ? 1 : -1 ))
-zstyle -s ':completion:$curcontext:dates' date-format userformat
+zstyle -s ":completion:${curcontext}:dates" date-format userformat
 format=${userformat:-${format[2]:-%F}}
 
-zstyle -a ':completion:$curcontext:dates' max-matches-length r
+zstyle -a ":completion:${curcontext}:dates" max-matches-length r
 for ri in $r; do
   [[ $ri = [0-9]##% ]] && (( ri = LINES * .${ri%%%} ))
   (( ri < rows )) && (( rows=ri ))


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix unintentional history modifiers.
  2016-09-22 11:43 [PATCH] Fix unintentional history modifiers Daniel Shahaf
@ 2016-09-22 16:34 ` Bart Schaefer
  2016-09-22 20:14   ` Daniel Shahaf
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2016-09-22 16:34 UTC (permalink / raw)
  To: zsh-workers

On Sep 22, 11:43am, Daniel Shahaf wrote:
} Subject: [PATCH] Fix unintentional history modifiers.
}
} The _dates one worked even before this patch (!); I haven't investigated why.

The _dsh one should have worked too.  There is no :d modifier, so:

torch% echo $foo:d
:d

There is a :c modifier (search the command path) so $service:commands
would break.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix unintentional history modifiers.
  2016-09-22 16:34 ` Bart Schaefer
@ 2016-09-22 20:14   ` Daniel Shahaf
  2016-09-22 20:46     ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2016-09-22 20:14 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote on Thu, Sep 22, 2016 at 09:34:45 -0700:
> On Sep 22, 11:43am, Daniel Shahaf wrote:
> } Subject: [PATCH] Fix unintentional history modifiers.
> }
> } The _dates one worked even before this patch (!); I haven't investigated why.
> 
> The _dsh one should have worked too.  There is no :d modifier, so:

This doesn't explain why _dates worked: it had a parameter expansion in
a single-quoted string.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix unintentional history modifiers.
  2016-09-22 20:14   ` Daniel Shahaf
@ 2016-09-22 20:46     ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2016-09-22 20:46 UTC (permalink / raw)
  To: zsh-workers

On Sep 22,  8:14pm, Daniel Shahaf wrote:
}
} This doesn't explain why _dates worked: it had a parameter expansion in
} a single-quoted string.

Ah.

Well, remember that zstyles are sort of inverse lookups:  You store them
with a pattern, and then look them up with a fixed string.  So even if
the fixed string (from _dates in this case) is wrong, it might still
be matched by the pattern if that pattern was not specific enough.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-22 20:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22 11:43 [PATCH] Fix unintentional history modifiers Daniel Shahaf
2016-09-22 16:34 ` Bart Schaefer
2016-09-22 20:14   ` Daniel Shahaf
2016-09-22 20:46     ` Bart Schaefer

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).