about summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2004-05-20 22:23:11 +0000
committerWayne Davison <wayned@users.sourceforge.net>2004-05-20 22:23:11 +0000
commit6b83748946e9405bc9df946a44e776e4adcff867 (patch)
treeadef5c84b5a57349c5ec13ded3567823368ad313 /Functions
parent690866621a86239f0f6f5fb745c1204d2b5a31a9 (diff)
downloadzsh-6b83748946e9405bc9df946a44e776e4adcff867.tar.gz
zsh-6b83748946e9405bc9df946a44e776e4adcff867.tar.xz
zsh-6b83748946e9405bc9df946a44e776e4adcff867.zip
Use the new history push/pop options to fc to save and restore the
current history buffer.
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Misc/zcalc17
1 files changed, 4 insertions, 13 deletions
diff --git a/Functions/Misc/zcalc b/Functions/Misc/zcalc
index 37e06557c..d416ade92 100644
--- a/Functions/Misc/zcalc
+++ b/Functions/Misc/zcalc
@@ -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