From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Subject: PATCH: zcalcrc
Date: Thu, 01 Oct 2015 15:51:03 +0100 [thread overview]
Message-ID: <20151001155103.062c4964@pwslap01u.europe.root.pri> (raw)
Should be self explanatory.
pws
diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index 330c6f5..635f9b0 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -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))\
diff --git a/Functions/Misc/zcalc b/Functions/Misc/zcalc
index 63f67ad..17700e4 100644
--- a/Functions/Misc/zcalc
+++ b/Functions/Misc/zcalc
@@ -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]}
reply other threads:[~2015-10-01 14:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151001155103.062c4964@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).