zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk
Subject: Re: Clarify zshaddhistory doc?
Date: Thu, 19 Feb 2009 10:02:11 +0000	[thread overview]
Message-ID: <20090219100211.74bc9b18@news01> (raw)
In-Reply-To: <090218103939.ZM17460@torch.brasslantern.com>

On Wed, 18 Feb 2009 10:39:39 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Feb 18,  5:09pm, Peter Stephenson wrote:
> }
> } > What exactly does this mean?  There's no $zshaddhistory_functions array
> } > so "any of the hook functions" is either a typo, or must refer to the
> } > $preexec_functions hooks, which ought to be clearer.
> } 
> } There isn't a zshaddhistory_functions array until you add one, then
> } there is.
> 
> Hrm.  Well, then, perhaps the explicit reference to "preexec_functions"
> in Src/init.c is wrong, and it should be using the HOOK_SUFFIX constant?

Index: Src/init.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/init.c,v
retrieving revision 1.98
diff -u -r1.98 init.c
--- Src/init.c	11 Feb 2009 20:42:16 -0000	1.98
+++ Src/init.c	19 Feb 2009 09:57:52 -0000
@@ -150,7 +150,7 @@
 
 	    if (toplevel &&
 		(getshfunc("preexec") ||
-		 paramtab->getnode(paramtab, "preexec_functions"))) {
+		 paramtab->getnode(paramtab, "preexec" HOOK_SUFFIX))) {
 		LinkList args;
 		char *cmdstr;
 
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.208
diff -u -r1.208 utils.c
--- Src/utils.c	5 Jan 2009 21:56:53 -0000	1.208
+++ Src/utils.c	19 Feb 2009 09:57:52 -0000
@@ -1174,8 +1174,6 @@
     if (arrayp) {
 	char **arrptr;
 	int namlen = strlen(name);
-#define HOOK_SUFFIX	"_functions"
-#define HOOK_SUFFIX_LEN	11	/* including NUL byte */
 	VARARR(char, arrnam, namlen + HOOK_SUFFIX_LEN);
 	memcpy(arrnam, name, namlen);
 	memcpy(arrnam + namlen, HOOK_SUFFIX, HOOK_SUFFIX_LEN);
Index: Src/zsh.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v
retrieving revision 1.152
diff -u -r1.152 zsh.h
--- Src/zsh.h	11 Feb 2009 20:42:16 -0000	1.152
+++ Src/zsh.h	19 Feb 2009 09:57:52 -0000
@@ -1117,6 +1117,15 @@
 #define WRAPDEF(func) \
     { NULL, 0, func, NULL }
 
+/*
+ * User-defined hook arrays
+ */
+
+/* Name appended to function name to get hook array */
+#define HOOK_SUFFIX	"_functions"
+/* Length of that including NUL byte */
+#define HOOK_SUFFIX_LEN	11
+
 /* node in builtin command hash table (builtintab) */
 
 /*



-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


      reply	other threads:[~2009-02-19 10:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-18 16:57 Bart Schaefer
2009-02-18 17:09 ` Peter Stephenson
2009-02-18 17:15   ` Mikael Magnusson
2009-02-18 18:39   ` Bart Schaefer
2009-02-19 10:02     ` Peter Stephenson [this message]

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=20090219100211.74bc9b18@news01 \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /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).