From: Dmitri Paduchikh <dpaduchikh@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Richard Stallman <rms@gnu.org>, emacs-devel@gnu.org
Subject: Re: Brittleness of called-interactively-p
Date: Fri, 07 Aug 2015 18:35:20 +0500 [thread overview]
Message-ID: <87fv3v43xj.fsf@gmail.com> (raw)
In-Reply-To: <jwv4mkct5ev.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 06 Aug 2015 18:33:32 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> These calls are internal to the advice mechanism and, of course, they
>> cannot be considered conceptually interactive.
SM> If the original function uses called-interactively-p and the "whole
SM> advised function" is called interactively, then called-interactively-p
SM> should return t, yet this call is inside an interactive function which
SM> is called non-interactively.
Exactly, see above. I thought that may be it is better to associate
interactive form with function symbol rather than with function itself. This
would solve issues with calls that are internal to advice system. When
advised, the original function becomes non-interactive automatically. There
can be other issues with such approach though. The most obvious one is that
it is not longer possible to use interactive lambdas. Personally I think
that they are not so necessary and are better to be avoided when defining
key bindings because symbols look better in help output. Also there is
problem with idiom like this:
(call-interactively (lambda (b e) (interactive "r") ...))
But note that conceptually this is not a interactive call of command. It is
about reusing the feature of interactive calls to obtain values for
arguments. So it probably can be replaced with something like
(call-with-interactive-args "r" (lambda (b e) ...))
>> It is not clear for me whether this approach will help to solve the current
>> problem of macros wrapping fragments of code in lambdas.
SM> BTW, the real solution, which is simple and reliable is to not use
SM> called-interactively-p at all, and use an argument instead:
SM> (defun foo (bar &optional called-interactively)
SM> (interactive (list toto t))
Yes, indeed, and this method is described in the doc string of
called-interactively-p. This means however that one odd argument is added to
the function interface which plays only technical role. And also advices
which need this information will have to modify the argument list of the
original function if it does not provide it already.
RMS had an idea to make sort of separate argument for this purpose which
does not belong to function interface. My comment above was directed to him.
As you can see I was confused, since in theory it can work with macros and
lambdas no worse than your recommendation of using special argument. I have
not ideas about this approach, so do not comment it further.
I will be away for next ten days, and so won't be able to participate in the
discussion in the case you or somebody else is interested.
next prev parent reply other threads:[~2015-08-07 13:35 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-12 5:00 Brittleness of called-interactively-p Dmitri Paduchikh
2015-07-12 13:53 ` Stefan Monnier
2015-07-12 15:17 ` Dmitri Paduchikh
2015-07-12 23:26 ` Stefan Monnier
2015-07-13 15:17 ` Dmitri Paduchikh
2015-07-14 23:24 ` Stefan Monnier
2015-07-16 15:57 ` raman
2015-07-16 17:36 ` Drew Adams
2015-07-16 17:58 ` T.V Raman
2015-07-17 1:55 ` Richard Stallman
2015-07-17 4:52 ` Dmitri Paduchikh
2015-07-17 13:36 ` Dmitri Paduchikh
[not found] ` <jwvpp3qp9dn.fsf-monnier+emacs@gnu.org>
2015-07-18 5:16 ` Dmitri Paduchikh
2015-07-17 18:15 ` raman
2015-07-17 18:14 ` raman
2015-07-17 19:31 ` Drew Adams
2015-07-17 23:25 ` raman
2015-07-18 1:47 ` Drew Adams
2015-07-20 12:19 ` Andreas Röhler
2015-07-16 22:55 ` Stefan Monnier
2015-07-17 18:10 ` raman
2015-07-18 0:57 ` Stefan Monnier
2015-07-18 4:39 ` Dmitri Paduchikh
2015-07-20 12:22 ` Andreas Röhler
2015-07-20 22:23 ` Stefan Monnier
2015-08-06 22:30 ` Stefan Monnier
2015-08-06 22:33 ` Stefan Monnier
2015-08-07 13:35 ` Dmitri Paduchikh [this message]
2015-08-07 17:18 ` Stefan Monnier
2015-07-18 22:29 ` raman
2015-07-12 21:59 ` Richard Stallman
2015-07-13 15:17 ` Dmitri Paduchikh
2015-07-13 23:03 ` Richard Stallman
2015-08-06 22:36 ` Stefan Monnier
2015-07-17 20:35 ` Przemysław Wojnowski
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=87fv3v43xj.fsf@gmail.com \
--to=dpaduchikh@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=rms@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.