From unknown Sat Sep 20 23:20:40 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#68294 <68294@debbugs.gnu.org> To: bug#68294 <68294@debbugs.gnu.org> Subject: Status: [PATCH] Set the 'name' prop in 'define-advice' Reply-To: bug#68294 <68294@debbugs.gnu.org> Date: Sun, 21 Sep 2025 06:20:40 +0000 retitle 68294 [PATCH] Set the 'name' prop in 'define-advice' reassign 68294 emacs submitter 68294 Steven Allen severity 68294 normal tag 68294 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 06 12:54:59 2024 Received: (at submit) by debbugs.gnu.org; 6 Jan 2024 17:54:59 +0000 Received: from localhost ([127.0.0.1]:60266 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMAss-0003Iw-Ii for submit@debbugs.gnu.org; Sat, 06 Jan 2024 12:54:58 -0500 Received: from lists.gnu.org ([2001:470:142::17]:54650) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMAsq-0003Ij-3U for submit@debbugs.gnu.org; Sat, 06 Jan 2024 12:54:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rMAsf-00045U-7Y for bug-gnu-emacs@gnu.org; Sat, 06 Jan 2024 12:54:45 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rMAsc-0007db-Ck for bug-gnu-emacs@gnu.org; Sat, 06 Jan 2024 12:54:44 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id E179C5C01D1 for ; Sat, 6 Jan 2024 12:54:38 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sat, 06 Jan 2024 12:54:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stebalien.com; h=cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm1; t=1704563678; x=1704650078; bh=FoheAbnphzzesYBLlKb80PStrKlXp+eS xaYNS6xmWMM=; b=jxtCewwJqksD9hJZLAAPE81vL+TLgxlb6y02Fktfciv1c1tN xI6H5FguQzUT4KfWMzNy0b3YPNokytdr3IfrzhWoYvfaoOI9pYol26VusF4XWcxo 5qgyDyiNKn2vsK85M7fxFMgySwW+MXlnm7WahDEUqZrDaoOovEN8uSwkVcnby9W9 HgXr1szHLzecl9Zb4936uigU8sKOybuLZJogdx2k8TqTU4OT68Jd3xD+S/jrRbox dIFJxbiynSN69Ii7g6WBWWnEFUMiJfPkJflObCHUh7JueA2wcGUtsOs7UH2kRc07 /GOCCYOk/fqWgyBFZv+mGNOs6091I4gn+RU4tg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1704563678; x=1704650078; bh=FoheAbnphzzesYBLlKb80PStrKlXp+eSxaY NS6xmWMM=; b=MBltXTcNTJ36jrHiomZwMpq/p6EDoV/qgt8B+sNfHXML9/dEP1M EdZLzjMJulOpJs1QhLjab+tcAGbA9w5Ndb3gFPbNWKtvovx54y6U1jHYbFyGgdNM 5k3njJJytV4ljKtrSsEkj0n/QohZZbU8Hh9jHCZp+MvVjqfvzd2fFq2EAvqd0316 ksDIWt9oDEMWAWOGK8MoWz89tOHc/m9ZzLG05bXah/Cs0eLU2I3BKhXvUUkK5rv/ snXYYyQE4x1RETceCYWFExLcRloRwAGqrDCWPIBsD3cdl76Jc4vFhLbnLHIUwtDZ yIWCg7+/Yi16U8ql5rq6Wlj/oi9wIJQjSIg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdehuddguddtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfggtgesmhdtreertd dttdenucfhrhhomhepufhtvghvvghnucetlhhlvghnuceoshhtvghvvghnsehsthgvsggr lhhivghnrdgtohhmqeenucggtffrrghtthgvrhhnpeekffffgfevteehtdeiffelffegke dvieeigeehfedtteejkeefhfevtddtkeefffenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpehsthgvvhgvnhesshhtvggsrghlihgvnhdrtghomh X-ME-Proxy: Feedback-ID: ie8a146a7:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 6 Jan 2024 12:54:38 -0500 (EST) From: Steven Allen To: bug-gnu-emacs@gnu.org Subject: [PATCH] Set the 'name' prop in 'define-advice' Date: Sat, 06 Jan 2024 09:54:36 -0800 Message-ID: <87h6jqwdnn.fsf@stebalien.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=66.111.4.28; envelope-from=steven@stebalien.com; helo=out4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.6 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.4 (/) --=-=-= Content-Type: text/plain In addition to naming the advice function 'symbol@name', set the 'name' property to NAME. The code should be good, but I'm less sure about the updated documentation. Requested in Bug#68114. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment >From b76e46a2a6e80dcec8845fb216e126068e2c4ac3 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Sat, 6 Jan 2024 09:19:12 -0800 Subject: [PATCH] Set the 'name' prop in 'define-advice' In addition to naming the advice function `symbol@name', set the 'name' property to NAME. * lisp/emacs-lisp/nadvice.el (define-advice): set the name property to name (requested in Bug#68114). * doc/lispref/functions.texi (Advising Named Functions): Document that 'define-advice' installs the advice with the specified name. --- doc/lispref/functions.texi | 7 ++++--- etc/NEWS | 6 ++++++ lisp/emacs-lisp/nadvice.el | 8 +++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 29e9f04a076..48f32ec907d 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -2066,9 +2066,10 @@ Advising Named Functions @defmac define-advice symbol (where lambda-list &optional name depth) &rest body This macro defines a piece of advice and adds it to the function named -@var{symbol}. The advice is an anonymous function if @var{name} is -@code{nil} or a function named @code{symbol@@name}. See -@code{advice-add} for explanation of other arguments. +@var{symbol}. If @var{name} is non-nil, the advice is named +@code{symbol@@name} and installed with the name @var{name}; otherwise, +the advice is anonymous. See @code{advice-add} for explanation of +other arguments. @end defmac @defun advice-add symbol where function &optional props diff --git a/etc/NEWS b/etc/NEWS index 3a1168f62b3..a26b270d44f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1393,6 +1393,12 @@ values. * Lisp Changes in Emacs 30.1 ++++ +** 'define-advice' now sets the new advice's 'name' property to NAME +Named advice defined with 'define-advice' can now be remove with +'(advice-remove SYMBOL NAME)' in addition to '(advice-remove SYMBOL +SYMBOL@NAME)'. + +++ ** New function 'require-with-check' to detect new versions shadowing. This is like 'require', but it checks whether the argument 'feature' diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el index de287e43b21..7524ab18e58 100644 --- a/lisp/emacs-lisp/nadvice.el +++ b/lisp/emacs-lisp/nadvice.el @@ -585,8 +585,8 @@ advice-remove (defmacro define-advice (symbol args &rest body) "Define an advice and add it to function named SYMBOL. See `advice-add' and `add-function' for explanation on the -arguments. Note if NAME is nil the advice is anonymous; -otherwise it is named `SYMBOL@NAME'. +arguments. If NAME is non-nil, the advice is named `SYMBOL@NAME' +and installed with the name NAME; otherwise, the advice is anonymous. \(fn SYMBOL (HOW LAMBDA-LIST &optional NAME DEPTH) &rest BODY)" (declare (indent 2) (doc-string 3) (debug (sexp sexp def-body))) @@ -597,7 +597,9 @@ define-advice (lambda-list (nth 1 args)) (name (nth 2 args)) (depth (nth 3 args)) - (props (and depth `((depth . ,depth)))) + (props (append + (and depth `((depth . ,depth))) + (and name `((name . ,name))))) (advice (cond ((null name) `(lambda ,lambda-list ,@body)) ((or (stringp name) (symbolp name)) (intern (format "%s@%s" symbol name))) -- 2.43.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 07 01:27:27 2024 Received: (at 68294) by debbugs.gnu.org; 7 Jan 2024 06:27:27 +0000 Received: from localhost ([127.0.0.1]:60575 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMMd4-0000te-TU for submit@debbugs.gnu.org; Sun, 07 Jan 2024 01:27:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53276) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMMd2-0000tS-JP for 68294@debbugs.gnu.org; Sun, 07 Jan 2024 01:27:25 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rMMcr-0001CW-LH; Sun, 07 Jan 2024 01:27:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=exw4Ca00kFlXV6HM/C3mfwqsNKAQZIq0L1PHUTvEuJ0=; b=CxWdC4oPPJXB vp4+vhF2bIVW04odBCCByI6NxUEhA9F0iJs1joOwesYcxkYEVlv6d7AcD/MQU8ggM6cjhXdr6sQ+w 6ZVSXY0S9o3QFr1lak+11WcqP2JKoMigWVDf3jgfXDkjCBlsG36lUScis318weMGy7ulaLZCxEWuf m5R+uAhAwwKNEUpb0rkPfGtTXcpfxHTh8tAk9To9vSx7NvQtum85AKcY8sU4w+9oGojHAHotA77z4 7OS8Wbue/L32awgU9li1ncH3AXxsSFZEhHwAZRSE/v82aN5jWWLv3pOPfpfg8kuUFDTJMhz1f7VHj siOr+dVkifCk6+ZFiqHmEA==; Date: Sun, 07 Jan 2024 08:27:03 +0200 Message-Id: <83edetsloo.fsf@gnu.org> From: Eli Zaretskii To: Steven Allen , Stefan Monnier In-Reply-To: <87h6jqwdnn.fsf@stebalien.com> (message from Steven Allen on Sat, 06 Jan 2024 09:54:36 -0800) Subject: Re: bug#68294: [PATCH] Set the 'name' prop in 'define-advice' References: <87h6jqwdnn.fsf@stebalien.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68294 Cc: 68294@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Steven Allen > Date: Sat, 06 Jan 2024 09:54:36 -0800 > > In addition to naming the advice function 'symbol@name', set the 'name' > property to NAME. The code should be good, but I'm less sure about the > updated documentation. > > Requested in Bug#68114. Stefan, any comments? > @defmac define-advice symbol (where lambda-list &optional name depth) &rest body > This macro defines a piece of advice and adds it to the function named > -@var{symbol}. The advice is an anonymous function if @var{name} is > -@code{nil} or a function named @code{symbol@@name}. See > -@code{advice-add} for explanation of other arguments. > +@var{symbol}. If @var{name} is non-nil, the advice is named > +@code{symbol@@name} and installed with the name @var{name}; otherwise, ^^^^^^^^^^^^^^^^^^^ This should be @code{@var{symbol}@@@var{name}}. > +** 'define-advice' now sets the new advice's 'name' property to NAME > +Named advice defined with 'define-advice' can now be remove with ^^^^^^ This should be "removed". From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 07 09:59:07 2024 Received: (at 68294) by debbugs.gnu.org; 7 Jan 2024 14:59:07 +0000 Received: from localhost ([127.0.0.1]:33542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMUcF-0002KU-9y for submit@debbugs.gnu.org; Sun, 07 Jan 2024 09:59:07 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:32594) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMUcD-0002Ju-EC for 68294@debbugs.gnu.org; Sun, 07 Jan 2024 09:59:05 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 810018093D; Sun, 7 Jan 2024 09:58:53 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1704639532; bh=yI+tmrt4pa5HpMCBPgUpN8NZtVZTt5YQVtwyLpLwTs0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=cZ+T5K1bYpAzuAGWpsttrom0tNVUej0Y3nYTc3fAO6YjNvHJi1nn/XKdncUMuORlq 2ZgIDteN5ajc0tRF+PwmX+3oAWF7BLlWTxh2KwPgojlMqaS0SoWKjPH7C4dYNO2rx8 S6yYdWNDieHYhE1w/D7hTZJOqaadonsL8BbHocW+KPSfMb68tQr7FJcIdopxf8x0Mf iLTtvT9WGgogBZbqtOLhjmRjq2bcSXhAVKYZOMYOXstJQR4jANrXCwzv0By7pNghRr N9Y3Zw5DVxpy+REbQsJydXuP2kLYYHe4u9+i1rt3A0TyjMJcl+6Tor402tiJryeLv3 KgpPFIoC+X0Kw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A9BC78092C; Sun, 7 Jan 2024 09:58:52 -0500 (EST) Received: from pastel (65-110-221-238.cpe.pppoe.ca [65.110.221.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7F7881203CA; Sun, 7 Jan 2024 09:58:52 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#68294: [PATCH] Set the 'name' prop in 'define-advice' In-Reply-To: <83edetsloo.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 07 Jan 2024 08:27:03 +0200") Message-ID: References: <87h6jqwdnn.fsf@stebalien.com> <83edetsloo.fsf@gnu.org> Date: Sun, 07 Jan 2024 09:58:51 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.023 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68294 Cc: 68294@debbugs.gnu.org, Steven Allen X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> In addition to naming the advice function 'symbol@name', set the 'name' >> property to NAME. The code should be good, but I'm less sure about the >> updated documentation. >> Requested in Bug#68114. > > Stefan, any comments? Sounds fine to me. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 08 10:42:48 2024 Received: (at 68294) by debbugs.gnu.org; 8 Jan 2024 15:42:48 +0000 Received: from localhost ([127.0.0.1]:37321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMrm4-00065q-3h for submit@debbugs.gnu.org; Mon, 08 Jan 2024 10:42:48 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:34311) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMrm0-00065Y-7T for 68294@debbugs.gnu.org; Mon, 08 Jan 2024 10:42:46 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id AF8CA5C108F; Mon, 8 Jan 2024 10:42:32 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 08 Jan 2024 10:42:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stebalien.com; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1704728552; x= 1704814952; bh=1GHNmjImNGXQplOM2YnBuHLT6GqK6+vEM4NN/dBhBQE=; b=B pxBWDzcybfDSfPE9BbUhqxVbId2SXaCIjPLl22MaF/6yHis6mZ1zLUIx4syxPRYK uHr4l6eGYDetf1XbCI2dAs2s7SsCZe/57arhrE4hTOEGsHQMwoD9s8WfVzgBZEh9 pwT61PIs81vRnnPW4bI2NY2y1iA20crAunXe/b4SoRcKeygfZxzWov9P0vdF3Gzw IcHe5CM85SKhNd4zu4WLqMwLj6RdvKkjFg+C08ICSMMlkbuYMWx9TZWoHJWMzJxB vaSzPWYJWQjfj7cnpSU4KIxeiwRlhZNbvwc/3fw4AnIhdIph5rScAO50yDk05QNF UrvwXHiiVCmdi0Hm4Q/tw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1704728552; x=1704814952; bh=1GHNmjImNGXQplOM2YnBuHLT6GqK 6+vEM4NN/dBhBQE=; b=1sL5Yj4QEckdCS6ypkaWh+K8dKDbvybJ515objrf5Gvf 9SSSZudEXj4qKUJuAnsPtHRCN/1gHOapPvdtJXcR2mQW8EJOuEa/ECRa2UVG7JaV FPQEmwZ4dqEg2xGFw6cZhup5I1uUoNoALfsLG1PHNtywCLbtPTxHq+tR9az/+0qQ pXD3naFOyvNvMGmHjYFLPNEHIFhTgCuT6n+JTTGgWyOtYySAYsIPGx/DWzGq5nEy x8dj6ijywsbPJzJKwRCgaxDE2p/Hy+SikvIqloQJ+fWkTe7Rba03B1k+08a+fY4o tb21R2exfzwBWsOu/LhmXedpZUyViXaomPG3CDNOPw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdehjedgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefujghffffkgggtsehmtderredttddtnecuhfhrohhmpefuthgvvhgv nhcutehllhgvnhcuoehsthgvvhgvnhesshhtvggsrghlihgvnhdrtghomheqnecuggftrf grthhtvghrnhepjedufedvieejueektddtgedugeffveejheehieeulefgfffhleffheef vefhvdegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epshhtvghvvghnsehsthgvsggrlhhivghnrdgtohhm X-ME-Proxy: Feedback-ID: ie8a146a7:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 8 Jan 2024 10:42:32 -0500 (EST) From: Steven Allen To: Eli Zaretskii , Stefan Monnier Subject: Re: bug#68294: [PATCH] Set the 'name' prop in 'define-advice' In-Reply-To: <83edetsloo.fsf@gnu.org> References: <87h6jqwdnn.fsf@stebalien.com> <83edetsloo.fsf@gnu.org> Date: Mon, 08 Jan 2024 07:42:29 -0800 Message-ID: <8734v7x256.fsf@stebalien.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 68294 Cc: 68294@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain >> @defmac define-advice symbol (where lambda-list &optional name depth) &rest body >> This macro defines a piece of advice and adds it to the function named >> -@var{symbol}. The advice is an anonymous function if @var{name} is >> -@code{nil} or a function named @code{symbol@@name}. See >> -@code{advice-add} for explanation of other arguments. >> +@var{symbol}. If @var{name} is non-nil, the advice is named >> +@code{symbol@@name} and installed with the name @var{name}; otherwise, > ^^^^^^^^^^^^^^^^^^^ > This should be @code{@var{symbol}@@@var{name}}. Fixed. >> +** 'define-advice' now sets the new advice's 'name' property to NAME >> +Named advice defined with 'define-advice' can now be remove with > ^^^^^^ > This should be "removed". Fixed. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment >From 305f74ea832998f10555425225a1d35f137fc489 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Sat, 6 Jan 2024 09:19:12 -0800 Subject: [PATCH] Set the 'name' prop in 'define-advice' In addition to naming the advice function `symbol@name', set the 'name' property to NAME. * lisp/emacs-lisp/nadvice.el (define-advice): set the name property to name (requested in Bug#68114). Fixes Bug#68294. * doc/lispref/functions.texi (Advising Named Functions): Document that 'define-advice' installs the advice with the specified name. --- doc/lispref/functions.texi | 7 ++++--- etc/NEWS | 6 ++++++ lisp/emacs-lisp/nadvice.el | 8 +++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 29e9f04a076..29061e6561c 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -2066,9 +2066,10 @@ Advising Named Functions @defmac define-advice symbol (where lambda-list &optional name depth) &rest body This macro defines a piece of advice and adds it to the function named -@var{symbol}. The advice is an anonymous function if @var{name} is -@code{nil} or a function named @code{symbol@@name}. See -@code{advice-add} for explanation of other arguments. +@var{symbol}. If @var{name} is non-nil, the advice is named +@code{@var{symbol}@@@var{name}} and installed with the name @var{name}; otherwise, +the advice is anonymous. See @code{advice-add} for explanation of +other arguments. @end defmac @defun advice-add symbol where function &optional props diff --git a/etc/NEWS b/etc/NEWS index 3a1168f62b3..21b1aaee71a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1393,6 +1393,12 @@ values. * Lisp Changes in Emacs 30.1 ++++ +** 'define-advice' now sets the new advice's 'name' property to NAME +Named advice defined with 'define-advice' can now be removed with +'(advice-remove SYMBOL NAME)' in addition to '(advice-remove SYMBOL +SYMBOL@NAME)'. + +++ ** New function 'require-with-check' to detect new versions shadowing. This is like 'require', but it checks whether the argument 'feature' diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el index de287e43b21..7524ab18e58 100644 --- a/lisp/emacs-lisp/nadvice.el +++ b/lisp/emacs-lisp/nadvice.el @@ -585,8 +585,8 @@ advice-remove (defmacro define-advice (symbol args &rest body) "Define an advice and add it to function named SYMBOL. See `advice-add' and `add-function' for explanation on the -arguments. Note if NAME is nil the advice is anonymous; -otherwise it is named `SYMBOL@NAME'. +arguments. If NAME is non-nil, the advice is named `SYMBOL@NAME' +and installed with the name NAME; otherwise, the advice is anonymous. \(fn SYMBOL (HOW LAMBDA-LIST &optional NAME DEPTH) &rest BODY)" (declare (indent 2) (doc-string 3) (debug (sexp sexp def-body))) @@ -597,7 +597,9 @@ define-advice (lambda-list (nth 1 args)) (name (nth 2 args)) (depth (nth 3 args)) - (props (and depth `((depth . ,depth)))) + (props (append + (and depth `((depth . ,depth))) + (and name `((name . ,name))))) (advice (cond ((null name) `(lambda ,lambda-list ,@body)) ((or (stringp name) (symbolp name)) (intern (format "%s@%s" symbol name))) -- 2.43.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 13 04:44:47 2024 Received: (at 68294-done) by debbugs.gnu.org; 13 Jan 2024 09:44:47 +0000 Received: from localhost ([127.0.0.1]:38468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOaZK-0008N3-OU for submit@debbugs.gnu.org; Sat, 13 Jan 2024 04:44:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOaZI-0008Mp-2R for 68294-done@debbugs.gnu.org; Sat, 13 Jan 2024 04:44:45 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOaZE-0002Wa-1o; Sat, 13 Jan 2024 04:44:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=DBgaHy0RTIgI8MHnDASRUL4om28s9AhsWntD9TA5YY8=; b=e5/2vhkSFuZ0 atpV1TR6io8Rj5vwGWnFK7bwrxi/0r1ykC4vsfx2v/unBStKPtsHwL6OOoPvkY6rcxbTxewzjTPXZ hKL5lNsH54LEuFM6kombyNgY+U3ijeWjLiY7NblTZDnAoYNDNO0ttdsb8dgfXD43h8s/VtmAUoCQU Okeiz7smCCjCEWWA/t2FINJP0NI2PLC70SwGp3/E5ygyHmfMU12l44uTYKarcKqA6F/9vBW5P8W/x yiYVn+1OIS9M0JaVZvvxrM5k/dvInRkU5X/fayL5tCgAVR3/KxGoTNXQ6iSoFOtUuYr6ZT2k+xeAz 7UqWoFs8/iiX32x3zCzApw==; Date: Sat, 13 Jan 2024 11:44:19 +0200 Message-Id: <83bk9ph8jw.fsf@gnu.org> From: Eli Zaretskii To: Steven Allen In-Reply-To: <8734v7x256.fsf@stebalien.com> (message from Steven Allen on Mon, 08 Jan 2024 07:42:29 -0800) Subject: Re: bug#68294: [PATCH] Set the 'name' prop in 'define-advice' References: <87h6jqwdnn.fsf@stebalien.com> <83edetsloo.fsf@gnu.org> <8734v7x256.fsf@stebalien.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68294-done Cc: 68294-done@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Steven Allen > Cc: 68294@debbugs.gnu.org > Date: Mon, 08 Jan 2024 07:42:29 -0800 > > >> @defmac define-advice symbol (where lambda-list &optional name depth) &rest body > >> This macro defines a piece of advice and adds it to the function named > >> -@var{symbol}. The advice is an anonymous function if @var{name} is > >> -@code{nil} or a function named @code{symbol@@name}. See > >> -@code{advice-add} for explanation of other arguments. > >> +@var{symbol}. If @var{name} is non-nil, the advice is named > >> +@code{symbol@@name} and installed with the name @var{name}; otherwise, > > ^^^^^^^^^^^^^^^^^^^ > > This should be @code{@var{symbol}@@@var{name}}. > > Fixed. > > >> +** 'define-advice' now sets the new advice's 'name' property to NAME > >> +Named advice defined with 'define-advice' can now be remove with > > ^^^^^^ > > This should be "removed". > > Fixed. Thanks, installed on master, and closing the bug. From unknown Sat Sep 20 23:20:40 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 10 Feb 2024 12:24:22 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator