zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-users@sunsite.auc.dk
Subject: Execute a command *after* reading $HISTFILE
Date: Mon, 14 Aug 2000 18:04:29 +0000	[thread overview]
Message-ID: <1000814180429.ZM10088@candle.brasslantern.com> (raw)

My turn to ask a question.

When zsh starts up, reading the history file is the very last thing that it
does before entering the main interaction loop.

When zsh exits normally, it first writes the history, then reads .zlogout,
and finally runs the traps.

I have a situation where I'd like to read a different history file at
startup than is written-to at exit.  I can't simply call `fc -R' from one
of the startup files, because zsh will still read $HISTFILE and then I'll
have loaded both histories (and part of the one that I really wanted may
be lost if $HISTSIZE is reached).

It would almost work to call `fc -A' from .zlogout, but that gets into all
sorts of weird issues with incremental history.  What I really want is to
change $HISTFILE after zsh reads it.

Can anyone think of anything better than the following?

HISTFILE=~/.zhistory.$private
eval "function precmd() {
  HISTFILE=~.zhistory.shared
  function $(functions precmd)
}"

The problem with this, of course, is that if it's in .zlogin it doesn't
get installed in all interactive shells, but if it's in .zshrc then I have
to be careful not to change precmd again in .zlogin.

Suggestions?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


                 reply	other threads:[~2000-08-14 18:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1000814180429.ZM10088@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-users@sunsite.auc.dk \
    /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).