Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug#355430: zsh: acroread completion prints debugging information



> That doesn't seem to be it either.  E.g.:
> 
> schaefer<502> print -R ver=${${${(f)"$(</dev/null)"}:#^ver=*}##ver=}
> ver=

% emulate -R zsh
% print -R paco ver=${${${(f)"$(</home/clint/bin/acroread)"}:#^ver=*}##ver=}
paco ver=#!/bin/sh exec /usr/local/bin/acroread "$@"
% setopt extendedglob 
% print -R paco ver=${${${(f)"$(</home/clint/bin/acroread)"}:#^ver=*}##ver=}
paco ver=
% setopt rcexpandparam 
% print -R paco ver=${${${(f)"$(</home/clint/bin/acroread)"}:#^ver=*}##ver=}
paco

> } +local ver=${${${(f)"$(<$commands[$words[1]])"}:#(#s)ver=*}##ver=}
> 
> ... does not work for me at all.  The "^" does not mean "anchor at
> beginning", it means "do NOT match the following pattern".  What's
> really wanted is:
> 
> local ver=${${${(Mf)"$(<$commands[$words[1]])"}:#ver=*}##ver=}

Aha.

Index: Completion/X/Command/_acroread
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_acroread,v
retrieving revision 1.5
diff -u -r1.5 _acroread
--- Completion/X/Command/_acroread	10 May 2005 12:26:24 -0000	1.5
+++ Completion/X/Command/_acroread	26 Mar 2006 15:04:18 -0000
@@ -4,12 +4,12 @@
 
 # Try extracting the version number directly from the executable.
 # (This will fail if the executable is a wrapper script for acroread.)
-local ver=${${${(f)"$(<$commands[$words[1]])"}:#^ver=*}##ver=}
+local ver=${${${(Mf)"$(<$commands[$words[1]])"}:#ver=*}##ver=}
 [[ -n $ver ]] && _acroread_version=$ver
 
 if (( ! $+_acroread_version )); then
   local acropath=${${(s. .)${${(f)"$($words[1] -help 2>&1)"}[1]}}[2]}
-  _acroread_version=${${${(f)"$(<$acropath)"}:#^ver=*}##ver=}
+  _acroread_version=${${${(Mf)"$(<$acropath)"}:#ver=*}##ver=}
 fi
 
 if [[ $_acroread_version == 7.* ]]; then



Messages sorted by: Reverse Date, Date, Thread, Author