From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19212 invoked by alias); 15 Dec 2014 08:36:58 -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: 19539 Received: (qmail 13230 invoked from network); 15 Dec 2014 08:36:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) 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.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=PYxIXZlY c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=A92cGCtB03wA:10 a=WQ1Njo_7mZy-PVrAbE0A:9 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <141215003717.ZM24212@torch.brasslantern.com> Date: Mon, 15 Dec 2014 00:37:17 -0800 In-reply-to: Comments: In reply to Rocky Bernstein "Re: An example of writing a custom history file?" (Dec 15, 2:09am) References: <141214185332.ZM24112@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: An example of writing a custom history file? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Dec 15, 2:09am, Rocky Bernstein wrote: } } Thanks for the pointer. That program is too complicated and there is too } much going on for me to understand which parts add to the history file. I'm } guessing it has something to do with the } zle .push-line. Well, no, it doesn't have anything to do with that at all. } Here is the 138 line program boiled down to less than 10, the parts I'd } like to focus on: } } #!/usr/bin/zsh } fc -ap /tmp/example_history 1000 } # Read lines and add them to history } local sticky } while vared -h -p "hey: " sticky } do } print $sticky } sticky='' } done You've missed the important bit, which is the -s option to print. THAT is what adds lines to the history. I probably should have pointed you to the example zshaddhistory hook in the documentation. } Additionally what I would like to do in the body of the loop decide whether } or not to add this to the history. # Pseudo-code if this_line should be added to the history then print -sR "$this_line" fi