mirror of
https://github.com/zsh-users/zsh
synced 2024-11-05 16:08:45 +00:00
36735: add ~/.zcalcrc handling to zcalc
This commit is contained in:
parent
8bf72dd65b
commit
196e6a0ec0
3 changed files with 14 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
2015-10-01 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* 36735: Doc/Zsh/contrib.yo, Functions/Misc/zcalc: ~/.zcalcrc.
|
||||
|
||||
* Andrew Janke: 36729: MACHINES, NEWS, README: fix some typos.
|
||||
|
||||
* 36722: Completion/Unix/Command/_git: allow range to complete
|
||||
|
|
|
@ -3657,6 +3657,14 @@ integer arithmetic, which is not how an ordinary desk calculator
|
|||
operates. To force floating point operation, pass the option tt(-f);
|
||||
see further notes below.
|
||||
|
||||
If the file tt(~/.zcalcrc) exists it will be sourced inside the function
|
||||
once it is set up and about to process the command line. This
|
||||
can be used, for example, to set shell options; tt(emulate -L zsh)
|
||||
and tt(setopt extendedglob) are in effect at this point. Any
|
||||
failure to source the file if it exists is treated as fatal.
|
||||
As with other initialisation files, the directory tt($ZDOTDIR) is used
|
||||
instead of tt($HOME) if it is set.
|
||||
|
||||
The mathematical library tt(zsh/mathfunc) will be loaded if it is
|
||||
available; see
|
||||
ifzman(the section `The zsh/mathfunc Module' in zmanref(zshmodules))\
|
||||
|
|
|
@ -120,6 +120,10 @@ autoload -Uz zmathfuncdef
|
|||
float PI E
|
||||
(( PI = 4 * atan(1), E = exp(1) ))
|
||||
|
||||
if [[ -f "${ZDOTDIR:-$HOME}/.zcalcrc" ]]; then
|
||||
. "${ZDOTDIR:-$HOME}/.zcalcrc" || return 1
|
||||
fi
|
||||
|
||||
# Process command line
|
||||
while [[ -n $1 && $1 = -(|[#-]*|f|e) ]]; do
|
||||
optlist=${1[2,-1]}
|
||||
|
|
Loading…
Reference in a new issue