From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6575 invoked by alias); 26 Oct 2010 14:56:01 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15491 Received: (qmail 6167 invoked from network); 26 Oct 2010 14:55:51 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <101026075546.ZM28500@torch.brasslantern.com> Date: Tue, 26 Oct 2010 07:55:44 -0700 In-reply-to: Comments: In reply to Mikael Magnusson "accept-line-and-down-history and push-input" (Oct 26, 10:06am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: accept-line-and-down-history and push-input MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Oct 26, 10:06am, Mikael Magnusson wrote: } } I sometimes use accept-line-and-down-history to rerun a series of } commands, but occasionally need to run another command at some point } in the middle, but when returning from push-input, I'm left at the end } of history, not where I was. Is there some clever way I can wrap } push-input, or something, to make this work? You can read/assign to HISTNO. Something like this: with-saved-history-position() { typeset -g RESTORE_HISTNO=$HISTNO zle .$WIDGET "$@" } zle -N push-input with-saved-history-position zle-line-init() { [[ -n $RESTORE_HISTNO ]] && { HISTNO=$RESTORE_HISTNO typeset -g RESTORE_HISTNO='' } } zle -N zle-line-init (I'm beginning to think that zle-line-init should be a builtin widget that calls an array of hook functions, ala precmd.) --