From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3141 invoked by alias); 16 Dec 2014 11:36:21 -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: 19551 Received: (qmail 15568 invoked from network); 16 Dec 2014 11:36:18 -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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f4-b7f126d000001e9a-04-5490192e8086 Date: Tue, 16 Dec 2014 11:36:10 +0000 From: Peter Stephenson To: Zsh Users Subject: Re: An example of writing a custom history file? Message-id: <20141216113610.5470a964@pwslap01u.europe.root.pri> In-reply-to: References: <141214185332.ZM24112@torch.brasslantern.com> <141215003717.ZM24212@torch.brasslantern.com> <141215081440.ZM25053@torch.brasslantern.com> <141215102652.ZM25198@torch.brasslantern.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOLMWRmVeSWpSXmKPExsVy+t/xy7p6khNCDJYu4rbYcXIlowOjx6qD H5gCGKO4bFJSczLLUov07RK4Mj59v8JeMEOkYt2EPcwNjGcEuhg5OSQETCRWdK9nhrDFJC7c W8/WxcjFISSwlFFi/fGNzBDOIiaJ9gProZxtjBLXZzwGa2ERUJXY3d3NBmKzCRhKTN00mxHE FhFQlDjz6xsTiC0sYClxatk1sBpeAXuJLzNPsYDYnALBEieufmeHGLqORWJt8yWwBn4BfYmr fz8xQdxkLzHzyhlGiGZBiR+T74E1MwtoSWze1sQKYctLbF7zFuwgIQF1iRt3d7NPYBSahaRl FpKWWUhaFjAyr2IUTS1NLihOSs811CtOzC0uzUvXS87P3cQICdwvOxgXH7M6xCjAwajEw1vQ 2x8ixJpYVlyZe4hRgoNZSYR3y32gEG9KYmVValF+fFFpTmrxIUYmDk6pBsaSE0/nBHZ/4G0N tdC37liYX9XvXXPhbuxBljffH32w6JgdcGnL/GpehSRJvp7iqmal1lvGUzs/35v9+ceWNRpH r8qwJ/EnaEh9U+XoNBYS09OOk1eo6vB2OloY9nhKwLGkuWY9Bxfc2Wj51/ePyU7R/tMtKxiO s62b7zt76pFtn55bFk7ZoqvEUpyRaKjFXFScCABBTFRbOgIAAA== On Mon, 15 Dec 2014 19:34:52 +0100 Mikael Magnusson wrote: > I found only one place in the manpage that mentions history only being > active in an interactive shell, perhaps it should be clearer about it? > I also noticed that explicit fc -l and fc -W etc do nothing but also > don't print a warning when invoked non-interactively. Yes, this is definitely wrong. (Further discussion on this can go on zsh-workers but I wanted to respond initially here.) Here are a couple of places where it could be mentioned. The roadmap entry deliberately does not go into the gory subject of turning on the interactive option for scripts. (Yes, it's not a roadmap, it's an overview, in current corporate jargon.) By the way, I'm entirely open to making fc read and write history in non-interactive shells if we can manage that, but obviously it would need some work. diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 4463123..38788d3 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -657,6 +657,12 @@ xitem(tt( )[ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ]) xitem(tt(fc) tt(-p) [ tt(-a) ] [ var(filename) [ var(histsize) [ var(savehistsize) ] ] ]) xitem(tt(fc) tt(-P)) item(tt(fc) tt(-ARWI) [ var(filename) ])( +The tt(fc) command controls the interactive history mechanism. Note +that reading and writing of history options is only performed if the +shell is interactive. Usually this is detected automatically, but +it can be forced by setting the tt(interactive) option when starting the +shell. + Select a range of commands from var(first) to var(last) from the history list. The arguments var(first) and var(last) may be specified as a diff --git a/Doc/Zsh/roadmap.yo b/Doc/Zsh/roadmap.yo index ba598e5..6778489 100644 --- a/Doc/Zsh/roadmap.yo +++ b/Doc/Zsh/roadmap.yo @@ -41,7 +41,9 @@ set appropriate variables, and the number of history lines retained by default is quite small (30 lines). See the description of the shell variables (referred to in the documentation as parameters) tt(HISTFILE), tt(HISTSIZE) and tt(SAVEHIST) in ifzman(zmanref(zshparam))\ -ifnzman(noderef(Parameters Used By The Shell)). +ifnzman(noderef(Parameters Used By The Shell)). Note that it's +currently only possible to read and write files saving history +when the shell is interactive, i.e. it does not work from scripts. The shell now supports the UTF-8 character set (and also others if supported by the operating system). This is (mostly) handled transparently pws