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

Re: Global aliases, eval, and completion (Re: Expanding interactively aliases)



On Feb 26,  7:25am, Bart Schaefer wrote:
}
} } > My real point is that the existing _expand appears to be expanding
} } > global aliases already. [...] A quick check reveals that this is
} } > with the substitute style and is due to the fact that the aliases
} } > are expanded within eval.
} } 
} } Now that you say that... I seem to have a very faint memory of a
} } discussion about this (not in _expand, I think, we had the problem
} } somewhere else). I think we found a solution which I can't think of
} } now and I don't know where to search for it either.

I was just diffing some backup copies I'd made of things like minor changes
to _arguments against the current sources, and I found the solution I think
you're thinking about.

} [...] _arguments does things like
} 
} 	eval ws\=\( "${action[2,-2]}" \)
} and
} 	eval "action=( $action )"
} 
} There are a number of other completion functions that use eval for similar
} purposes.

We can replace all `eval's of that particular form with

	set -A ws ${=~action[2,-2]}
or
	set -A action ${=~action}

etc., which also gives us liberty to remove the wordsplitting or globbing
when appropriate (I think wordsplitting always is, but globbing might better
be left off in a few cases).

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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