unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Štěpán Němec" <stepnem@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: Michael Heerdegen <michael_heerdegen@web.de>,
	Lars Ingebrigtsen <larsi@gnus.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	17871@debbugs.gnu.org
Subject: bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?
Date: Wed, 21 Aug 2019 00:44:06 +0200	[thread overview]
Message-ID: <87o90jjw3t.fsf@gmail.com> (raw)
In-Reply-To: <87d0gzwnm6.fsf@mail.linkov.net> (Juri Linkov's message of "Wed,  21 Aug 2019 00:49:05 +0300")

On Wed, 21 Aug 2019 00:49:05 +0300
Juri Linkov wrote:

>> And although I have managed to clarify a few points myself thanks to
>> this conversation, my personal conundrum[2] remains unanswered: why does
>> a simple advice have no effect on the interactive spec of the function
>> being advised, and is that really a feature? But perhaps that's for
>> another thread.
>
> Recently I tried to use an advice to override the default call of
> `forward-word' in `org-metaright', but this is impossible to do
> because it called by `call-interactively'.  Maybe your case has the
> same problem?

Not really. The real-life example with commentary is in the cited
message (<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=17871#38>), but
a minimal example could be the following:

  (defvar __testvar nil)
  
  (defun __test-command ()
    (interactive (ignore (message "__test-command (interactive): %s" __testvar)))
    (message "__test-command (body): %s" __testvar))
  
  (defun __test-advice (orig &rest args)
    (let ((__testvar t))
      (apply orig args)))
  
  (advice-add '__test-command :around #'__test-advice)

Even with the advice, calling __test-command gives:

  __test-command (interactive): nil
  __test-command (body): t

I'd expect the advice to have effect on the whole function, including
the interactive form.

-- 
Štěpán





  reply	other threads:[~2019-08-20 22:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-29 14:13 bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function? Drew Adams
2014-06-29 15:01 ` Michael Heerdegen
2014-06-29 15:52   ` Drew Adams
2014-06-29 22:03     ` Stefan Monnier
2014-06-29 23:49       ` Drew Adams
2014-06-30 20:48     ` Michael Heerdegen
2019-08-04 12:06       ` Lars Ingebrigtsen
2019-08-04 12:45         ` Michael Heerdegen
2019-08-04 12:56           ` Lars Ingebrigtsen
2019-08-04 15:15             ` Štěpán Němec
2019-08-05  6:26             ` Michael Heerdegen
2019-08-05  8:44               ` Štěpán Němec
2019-08-05  9:21               ` Lars Ingebrigtsen
2019-08-18 12:26                 ` Michael Heerdegen
2019-08-18 13:32                   ` Štěpán Němec
2019-08-18 23:06                     ` Lars Ingebrigtsen
2019-08-18 23:50                       ` Štěpán Němec
2019-08-19  0:35                         ` Drew Adams
2019-08-20 21:49                         ` Juri Linkov
2019-08-20 22:44                           ` Štěpán Němec [this message]
2019-08-21  7:01                             ` Stefan Monnier
2019-08-21  8:17                               ` Štěpán Němec
2019-08-25 15:51                                 ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o90jjw3t.fsf@gmail.com \
    --to=stepnem@gmail.com \
    --cc=17871@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=larsi@gnus.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    /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.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).