From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19414 invoked from network); 15 Jun 1999 15:56:04 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 15 Jun 1999 15:56:04 -0000 Received: (qmail 9096 invoked by alias); 15 Jun 1999 15:55:55 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6643 Received: (qmail 9089 invoked from network); 15 Jun 1999 15:55:53 -0000 Message-Id: <9906151527.AA30610@ibmth.df.unipi.it> To: "'zsh-workers@sunsite.auc.dk'" Subject: Re: history related suggestions In-Reply-To: ""Kiddle, Oliver""'s message of "Tue, 15 Jun 1999 14:10:54 DFT." <4FBF540FF16FD1119D9600A0C94B2B51F29E89@napier.logica.co.uk> Date: Tue, 15 Jun 1999 17:27:14 +0200 From: Peter Stephenson "Kiddle, Oliver" wrote: > I'm not convinced by the zle set-local-history system for toggling between > local and shared history. I (and I would think most people) will bind one > set of keys to shared history operations and another set to local ones > rather than binding a key to toggle the history mode. You're supposed to use a widget function rather than bind it directly. (What's happened to the manual entry for set-local-history in the zle documentation? It doesn't seem to say anywhere how it works.) this-with-local-history() { local savnum=$NUMERIC NUMERIC=1 zle set-local-history NUMERIC=$savnum zle the-normal-this-command NUMERIC=0 zle set-local-history } zle -N this-with-local-history bindkey '...' this-with-local-history (this will all become smoother when argument handling becomes standardised anyway). > With argument handling > hopefully being added to zle widgets (which I think is a great idea), I > think it would be better to ditch set-local-history and add an option to > each of the history related widgets specifying whether to use shared or > local history. It might be a nice idea to add this. > Along with this, I would suggest that parameter expansion be > done on the zle widget arguments each time the widget is run. This would > allow users to do: > bindkey '^[[A' up-line-or-history '$history_toggle' > and then change the $history_toggle variable to select between local and > shared history. That sort of thing should certainly be done inside functions. up-line-or-history-switch() { zle up-line-or-history $history_toggle } zle -N up-line-or-history-switch bindkey '^[[A' up-line-or-history-switch Extra levels of expansion tend to make things a bit of a mess, and in my experience you always get to the point where you need the extra flexibility of a function anyway. (Cf. S. Wischnowsky, Collected New Completion Mailings, Zsh Workers Mailing List 1999, passim.) -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy