zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: An example of writing a custom history file?
Date: Tue, 16 Dec 2014 11:36:10 +0000	[thread overview]
Message-ID: <20141216113610.5470a964@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CAHYJk3Sk4ae8suGWMLU7Wm=vAQbMFUJp0sa1DOPTWA0vgY0r4g@mail.gmail.com>

On Mon, 15 Dec 2014 19:34:52 +0100
Mikael Magnusson <mikachu@gmail.com> 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


  reply	other threads:[~2014-12-16 11:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-15  1:38 Rocky Bernstein
2014-12-15  2:53 ` Bart Schaefer
2014-12-15  7:09   ` Rocky Bernstein
2014-12-15  8:37     ` Bart Schaefer
2014-12-15 14:26       ` Rocky Bernstein
2014-12-15 16:14         ` Bart Schaefer
2014-12-15 17:05           ` Rocky Bernstein
2014-12-15 17:46             ` Peter Stephenson
2014-12-15 18:22             ` Mikael Magnusson
2014-12-16  3:58               ` Rocky Bernstein
2014-12-15 18:26             ` Bart Schaefer
2014-12-15 18:34               ` Mikael Magnusson
2014-12-16 11:36                 ` Peter Stephenson [this message]
2014-12-16  5:57               ` Rocky Bernstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141216113610.5470a964@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).