mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-28 17:10:59 +01:00
Use the new history push/pop options to fc to save and restore the
current history buffer.
This commit is contained in:
parent
690866621a
commit
6b83748946
1 changed files with 4 additions and 13 deletions
|
|
@ -86,22 +86,13 @@
|
|||
emulate -L zsh
|
||||
setopt extendedglob
|
||||
|
||||
# can't be local since required in EXIT trap
|
||||
zcalc_orighist=$HISTFILE
|
||||
local temphist=${TMPPREFIX}zcalc_hist.$$ SAVEHIST=$HISTSIZE
|
||||
HISTFILE=$temphist
|
||||
fc -W
|
||||
|
||||
local HISTSIZE=0
|
||||
HISTSIZE=$SAVEHIST
|
||||
HISTFILE=~/.zcalc_history
|
||||
[[ -f $HISTFILE ]] && fc -R
|
||||
# push to our own history file
|
||||
fc -p ~/.zcalc_history
|
||||
|
||||
zcalc_restore() {
|
||||
unfunction zcalc_restore
|
||||
fc -W
|
||||
HISTFILE=$zcalc_orighist
|
||||
fc -R
|
||||
# pop back to original history
|
||||
fc -P
|
||||
}
|
||||
trap zcalc_restore HUP INT QUIT EXIT
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue