From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13973 invoked by alias); 28 Sep 2011 04:11:51 -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: 16452 Received: (qmail 9043 invoked from network); 28 Sep 2011 04:11:41 -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 autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at benizi.com does not designate permitted sender hosts) Date: Wed, 28 Sep 2011 00:11:10 -0400 (EDT) From: "Benjamin R. Haskell" To: Bart Schaefer cc: zsh-users@zsh.org Subject: Re: zshaddhistory confusion In-Reply-To: <110927071736.ZM25114@torch.brasslantern.com> Message-ID: References: <110927071736.ZM25114@torch.brasslantern.com> User-Agent: Alpine 2.01 (LNX 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Tue, 27 Sep 2011, Bart Schaefer wrote: > On Sep 26, 11:01pm, Benjamin R. Haskell wrote: > } > } The following doesn't seem to work, though I'd have thought it would > } based on the documentation... > } > } zshaddhistory () { > } fc -p ~/.zsh_history_detail > } print -sr -- "${1%%$'\n'} ### ${PWD} $(date '+%Y-%m-%d %R')" > } fc -P > } } > > "Doesn't work" how? What does it [not] do that you were expecting? > > A hook function may call `fc -p ...' to switch the history context > so that the history is saved in a different file from the that in > the global HISTFILE parameter. This is handled specially: the > history context is automatically restored after the processing of > the history line is finished. > > What "handled specially" means here is that pushing the history stack > when you are inside the history hook automatically disables writing to > the normal history file, regardless of whether you "return 1" or call > "fc -P" or anything else. That should probably be made more explicit > in the doc, the only thing it's describing is the implicit "fc -pa". Yes, it sounds like you understand my confusion: I expected the implicit "fc -pa". I didn't expect that writing to the normal history file was disabled. -- Best, Ben