From: Roman Neuhauser <neuhauser@sigpipe.cz>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-users@zsh.org
Subject: Re: fndir introspection, site-packages documentation
Date: Sun, 15 Mar 2015 03:14:36 +0100 [thread overview]
Message-ID: <20150315021436.GQ4524@isis.sigpipe.cz> (raw)
In-Reply-To: <150313203904.ZM25016@torch.brasslantern.com>
[-- Attachment #1: Type: text/plain, Size: 537 bytes --]
# schaefer@brasslantern.com / 2015-03-13 20:39:04 -0700:
> On Mar 13, 11:41pm, Roman Neuhauser wrote:
> }
> } is there a way to get at the value "fndir" ended up having in configure?
>
> Sort of. The trouble is that if --enable-function-subdirs has been used
> for configure, there isn't really a useful scalar value of fndir, you
> have to have the whole $fpath array.
uh, sorry, i meant "sitefndir". anyway, how about the attached patch?
./Src/zsh -fc 'print -l "$ZSH_SITEFNDIR"'
/omg/share/zsh/site-functions
--
roman
[-- Attachment #2: 0001-ZSH_SITEFNDIR-exposes-the-path-to-site-functions.patch --]
[-- Type: text/x-diff, Size: 4110 bytes --]
>From e6949cebd4e8d78685071e42e58b0693d5699359 Mon Sep 17 00:00:00 2001
From: Roman Neuhauser <neuhauser@sigpipe.cz>
Date: Sun, 15 Mar 2015 03:18:26 +0100
Subject: [PATCH] $ZSH_SITEFNDIR exposes the path to site-functions
---
Doc/Zsh/params.yo | 35 +++++++++++++++++++++++++++++++----
NEWS | 2 ++
Src/params.c | 15 +++++++++++++++
3 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 2f78920..2ad2489 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -929,6 +929,14 @@ item(tt(zsh_scheduled_events))(
See ifzman(the section `The zsh/sched Module' in zmanref(zshmodules))\
ifnzman(noderef(The zsh/sched Module)).
)
+vindex(ZSH_SITEFNDIR)
+item(tt(ZSH_SITEFNDIR))(
+Installation directory for site-specific, non-version-specific functions.
+Zsh sets it to var(prefix)tt(/share/zsh/site-functions), or
+tt(/usr/local/share/zsh/site-functions) if it was configured with
+tt(--disable-site-fndir).
+Included in tt($fpath)/tt($FPATH).
+)
vindex(ZSH_SUBSHELL <S>)
item(tt(ZSH_SUBSHELL))(
Readonly integer. Initially zero, incremented each time the shell forks
@@ -1041,10 +1049,29 @@ vindex(fpath)
vindex(FPATH)
item(tt(fpath) <S> <Z> (tt(FPATH) <S>))(
An array (colon separated list)
-of directories specifying the search path for
-function definitions. This path is searched when a function
-with the tt(-u) attribute is referenced. If an executable
-file is found, then it is read and executed in the current environment.
+of directories specifying the search path for definitions of autoloaded
+functions. See the tt(autoload) builtin in
+ifzman(zmanref(zshbuiltins))\
+ifnzman(noderef(Shell Builtin Commands)),
+and
+ifzman(em(Autloading Functions) in zmanref(zshmisc))\
+ifnzman(noderef(Autloading Functions)).
+On startup, zsh sets this to one or more directories depending on
+the way it was configured.
+Default configuration leads to these values:
+tt(/usr/local/share/zsh/site-functions) followed by
+var(prefix)tt(/share/zsh/site-functions)
+(unless var(prefix) is tt(/usr/local)), followed by a list of
+var(prefix)tt(/share/zsh/$ZSH_VERSION/functions) subdirectories.
+Default var(prefix) is tt(/usr/local).
+tt(/usr/local/share/zsh/site-functions) is always included,
+even if it does not exist, and cannot be configured away.
+This is to increase the likelihood that locally added functions
+can be found with the shell running "out of the box", no matter how
+the shell was configured.
+
+If an executable file is found, then it is read and executed
+in the current environment.
)
vindex(histchars)
item(tt(histchars) <S>)(
diff --git a/NEWS b/NEWS
index bf8969b..d1949be 100644
--- a/NEWS
+++ b/NEWS
@@ -114,6 +114,8 @@ Changes since 5.0.0
Running fn writes "hello" to logfile. In older versions of the shell
it would create an empty file at the point of definition.
+- $ZSH_SITEFNDIR exposes the path to site-functions.
+
Changes between 4.2 and 5.0.0
-----------------------------
diff --git a/Src/params.c b/Src/params.c
index e8a9010..2a71e19 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -30,6 +30,8 @@
#include "zsh.mdh"
#include "params.pro"
+#include "zshpaths.h"
+
#include "version.h"
#ifdef CUSTOM_PATCHLEVEL
#define ZSH_PATCHLEVEL CUSTOM_PATCHLEVEL
@@ -684,6 +686,9 @@ createparamtable(void)
struct utsname unamebuf;
char *machinebuf;
#endif
+#if defined(SITEFPATH_DIR) || defined(FIXED_FPATH_DIR)
+ const char *sitefpathdir;
+#endif
paramtab = realparamtab = newparamtable(151, "paramtab");
@@ -807,6 +812,16 @@ createparamtable(void)
#else
setsparam("CPUTYPE", ztrdup_metafy("unknown"));
#endif
+
+#if defined(SITEFPATH_DIR) || defined(FIXED_FPATH_DIR)
+# ifdef SITEFPATH_DIR
+ sitefpathdir = ztrdup_metafy(SITEFPATH_DIR);
+# else
+ sitefpathdir = ztrdup_metafy(FIXED_FPATH_DIR);
+# endif
+ setsparam("ZSH_SITEFNDIR", ztrdup_metafy(sitefpathdir));
+#endif
+
setsparam("MACHTYPE", ztrdup_metafy(MACHTYPE));
setsparam("OSTYPE", ztrdup_metafy(OSTYPE));
setsparam("TTY", ztrdup_metafy(ttystrname));
--
2.3.2
next prev parent reply other threads:[~2015-03-15 2:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-13 22:41 Roman Neuhauser
2015-03-14 3:39 ` Bart Schaefer
2015-03-15 2:14 ` Roman Neuhauser [this message]
2015-03-15 19:14 ` Bart Schaefer
2015-03-16 9:36 ` patches format " Daniel Shahaf
2015-03-16 10:01 ` Peter Stephenson
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=20150315021436.GQ4524@isis.sigpipe.cz \
--to=neuhauser@sigpipe.cz \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@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).