zsh-users
 help / color / mirror / code / Atom feed
* Execute a command *after* reading $HISTFILE
@ 2000-08-14 18:04 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2000-08-14 18:04 UTC (permalink / raw)
  To: zsh-users

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   


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-08-14 18:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-14 18:04 Execute a command *after* reading $HISTFILE Bart Schaefer

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).