about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJulian Prein <druckdev@protonmail.com>2022-09-19 02:02:18 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2022-09-25 18:05:49 +0100
commit6e827d8f9a50653aa1905d8aff8cc91e6e2423c4 (patch)
treee37aaa84a16926dd8c5e68aa805cc5d623d1a432
parentab4d62eb975a4c4c51dd35822665050e2ddc6918 (diff)
downloadzsh-6e827d8f9a50653aa1905d8aff8cc91e6e2423c4.tar.gz
zsh-6e827d8f9a50653aa1905d8aff8cc91e6e2423c4.tar.xz
zsh-6e827d8f9a50653aa1905d8aff8cc91e6e2423c4.zip
50648: Use $ZCALC_HISTORY where appropriate
-rw-r--r--ChangeLog5
-rw-r--r--Doc/Zsh/contrib.yo7
-rw-r--r--Functions/Misc/zcalc4
3 files changed, 13 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 375172ec9..48c65d01b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-09-25  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 50648: Functions/Misc/zcalc: Julian Prein: Use ZCALC_HISTFILE
+	where defined for zcalc history.
+
 2022-09-21  Jun-ichi Takimoto  <takimoto-j@kba.biglobe.ne.jp>
 
 	* Nicholas Vinson: 50641: aczsh.m4, configure.ac: use 'int main()'
diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index 0ef59dbc9..96de5aa9b 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -3972,8 +3972,11 @@ calculation is stored.  For example, the result of the calculation on the
 line preceded by `tt(4> )' is available as tt($4).  The last value
 calculated is available as tt(ans).  Full command line editing, including
 the history of previous calculations, is available; the history is saved in
-the file tt(~/.zcalc_history).  To exit, enter a blank line or type `tt(:q)'
-on its own (`tt(q)' is allowed for historical compatibility).
+the file tt($ZCALC_HISTFILE).  If tt($ZCALC_HISTFILE) is unset,
+tt($ZDOTDIR/.zcalc_history) is used instead, which in turn falls backs to
+tt($HOME/.zcalc_history) if tt($ZDOTDIR) is unset.  To exit, enter a blank
+line or type `tt(:q)' on its own (`tt(q)' is allowed for historical
+compatibility).
 
 A line ending with a single backslash is treated in the same fashion
 as it is in command line editing:  the backslash is removed, the
diff --git a/Functions/Misc/zcalc b/Functions/Misc/zcalc
index 480373345..6cd2822c9 100644
--- a/Functions/Misc/zcalc
+++ b/Functions/Misc/zcalc
@@ -124,8 +124,10 @@ integer _rpn_mode _matched _show_stack _i _n
 integer _max_stack _push
 local -a _expressions stack
 
+
 # We use our own history file with an automatic pop on exit.
-history -ap "${ZDOTDIR:-$HOME}/.zcalc_history"
+history -ap "${ZCALC_HISTFILE:-${ZDOTDIR:-$HOME}/.zcalc_history}"
+
 
 _forms=( '%2$g' '%.*g' '%.*f' '%.*E' '')