Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: functions completion missed -s and -x
- X-seq: zsh-workers 42785
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: functions completion missed -s and -x
- Date: Wed, 16 May 2018 11:15:08 +0100
- Cms-type: 201P
- Dkim-filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180516101513euoutp0258f83b8651b181a42d634963afd15a3d~vGHqBBu6g0290102901euoutp02k
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1526465713; bh=Nrb80t/+bjg7CXJgUXOSpuEKnPCZDeOIUmino2sdoC4=; h=Date:From:To:Subject:In-Reply-To:References:From; b=tehEZZqlBIuEAumEFQOdPilW4HQy3HXH/weubNjHt0bmlwA5FnZA+4sGYHF5SCnY2 tZRocz+AfHoIhoi41QVXAI+D7gLb0YH2heTq18RkUgvFFwCVXHsUa8H1HWcR+r4Pi8 MuivdE/AuFW4nVBMi8z2mJEcOnpV4i3pNjSdcO9Q=
- In-reply-to: <20685.1526464539@thecus>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: SCSC
- References: <CGME20180516095641epcas4p240d76877aedbddfc42d29ce1b3945ee5@epcas4p2.samsung.com> <20685.1526464539@thecus>
On Wed, 16 May 2018 11:55:39 +0200
Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
> On the subject of math functions, is it not inconsistent with
> everything else that redefining a math function results in a
> "function already exists" error rather than being silent. If I
> re-source my .zshrc, it is silent apart from these errors.
Yes, and this unusual interface doesn't appear to be documented, either.
pws
diff --git a/Src/builtin.c b/Src/builtin.c
index 931605c..1cba97d 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3199,7 +3199,7 @@ bin_functions(char *name, char **argv, Options ops, int func)
pflags |= PRINT_NAMEONLY;
if (OPT_MINUS(ops,'M') || OPT_PLUS(ops,'M')) {
- MathFunc p, q;
+ MathFunc p, q, prev;
/*
* Add/remove/list function as mathematical.
*/
@@ -3331,15 +3331,10 @@ bin_functions(char *name, char **argv, Options ops, int func)
p->maxargs = maxargs;
queue_signals();
- for (q = mathfuncs; q; q = q->next) {
+ for (q = mathfuncs, prev = NULL; q; prev = q, q = q->next) {
if (!strcmp(q->name, funcname)) {
- unqueue_signals();
- zwarnnam(name, "-M %s: function already exists",
- funcname);
- zsfree(p->name);
- zsfree(p->module);
- zfree(p, sizeof(struct mathfunc));
- return 1;
+ removemathfunc(prev, q);
+ break;
}
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author