From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function? Date: Sun, 04 Aug 2019 14:06:39 +0200 Message-ID: <8736ihb0ds.fsf@mouse.gnus.org> References: <400906ac-35f1-48e4-8df9-8e65b340209b@default> <87vbrjdajs.fsf@web.de> <82178260-247b-4653-85db-d6586480419e@default> <87d2dqdsyj.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="195236"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Stefan Monnier , 17871@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 04 14:07:09 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1huFI5-000ogx-BX for geb-bug-gnu-emacs@m.gmane.org; Sun, 04 Aug 2019 14:07:09 +0200 Original-Received: from localhost ([::1]:44254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1huFI3-0007W5-VT for geb-bug-gnu-emacs@m.gmane.org; Sun, 04 Aug 2019 08:07:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41488) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1huFHz-0007Vv-5t for bug-gnu-emacs@gnu.org; Sun, 04 Aug 2019 08:07:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1huFHx-0003U5-UI for bug-gnu-emacs@gnu.org; Sun, 04 Aug 2019 08:07:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51900) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1huFHx-0003Ti-Qf for bug-gnu-emacs@gnu.org; Sun, 04 Aug 2019 08:07:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1huFHx-0004kf-J1 for bug-gnu-emacs@gnu.org; Sun, 04 Aug 2019 08:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Aug 2019 12:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17871 X-GNU-PR-Package: emacs Original-Received: via spool by 17871-submit@debbugs.gnu.org id=B17871.156492041018250 (code B ref 17871); Sun, 04 Aug 2019 12:07:01 +0000 Original-Received: (at 17871) by debbugs.gnu.org; 4 Aug 2019 12:06:50 +0000 Original-Received: from localhost ([127.0.0.1]:60721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huFHk-0004kF-C9 for submit@debbugs.gnu.org; Sun, 04 Aug 2019 08:06:50 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:36522) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huFHh-0004k5-MK for 17871@debbugs.gnu.org; Sun, 04 Aug 2019 08:06:46 -0400 Original-Received: from 77.18.62.220.tmi.telenormobil.no ([77.18.62.220] helo=sandy) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1huFHb-00078e-Uu; Sun, 04 Aug 2019 14:06:42 +0200 In-Reply-To: <87d2dqdsyj.fsf@web.de> (Michael Heerdegen's message of "Mon, 30 Jun 2014 22:48:36 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:164554 Archived-At: Michael Heerdegen writes: > Dunno if that would be good. Although we can with nadvice use > the same syntax for defining pieces of advice as for defining functions, > advices have a different meaning (semantic). The interactive > specs of advices are not exactly interactive specs in the common sense - > although they look similar, they are related, but different features. Yes, I think the description of this wrinkle of the interactive spec in advised functions belongs in this section of the manual and not in the normal `interactive' doc string. > I think a short example would be good. Also, the term "function" is a > bit unclear here, maybe we should add "a lambda expression or fbound > symbol" or so, to make clear that we don't mean a sexp that returns a > function. I've now added the "a lambda ..." etc to the manual, but while trying to find an example to use here, I came up short. But the manual says To interpret the spec received as argument, use @code{advice-eval-interactive-spec}. so I went looking for that function, and what I found was slightly puzzling: (defun advice-eval-interactive-spec (spec) "Evaluate the interactive spec SPEC." (cond ((stringp spec) ;; There's no direct access to the C code (in call-interactively) that ;; processes those specs, but that shouldn't stop us, should it? ;; FIXME: Despite appearances, this is not faithful: SPEC and ;; (advice-eval-interactive-spec SPEC) will behave subtly differently w.r.t ;; command-history (and maybe a few other details). (call-interactively `(lambda (&rest args) (interactive ,spec) args))) ;; ((functionp spec) (funcall spec)) (t (eval spec)))) The functionp case is commented out? This was apparently done in 1668ea9062e (in 2012!) by Stefan while rewriting this stuff. If nobody has missed this since 2012... perhaps it should just be removed? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no