Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: fndir introspection, site-packages documentation
# schaefer@xxxxxxxxxxxxxxxx / 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
From e6949cebd4e8d78685071e42e58b0693d5699359 Mon Sep 17 00:00:00 2001
From: Roman Neuhauser <neuhauser@xxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author