all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Drew Adams <drew.adams@oracle.com>
Cc: 17779@debbugs.gnu.org
Subject: bug#17779: 24.4.50; (elisp) `Using Interactive'
Date: Sun, 04 Aug 2019 14:41:55 +0200	[thread overview]
Message-ID: <87o9159k6k.fsf@mouse.gnus.org> (raw)
In-Reply-To: <79a25ee9-e53e-494f-b7e3-ebd2e2eebafa@default> (Drew Adams's message of "Sat, 14 Jun 2014 08:50:37 -0700 (PDT)")

Drew Adams <drew.adams@oracle.com> writes:

> I wonder about the bullet "It may be a Lisp expression that is not a
> string...".
>
> 1. The text for this does two things, which should perhaps be separated:
> (a) it describes the general nature and use of such an expression, and
> (b) it goes down a rabbit hole to talk about one particular gotcha.
>
> Combining these in the same bullet, which is supposed to present the
> non-string Lisp sexp case, just confuses things - that's my guess.
>
> 2. Wrt that gotcha: Really?  I'm probably missing something here, since
> this text has been in the manual for a long time.  But here's my take on
> this gotcha. What am I missing?

(I've included the .texi below for reference.)

Yes, I think you're right -- the text starting with "Providing point or
the mark" until the end of the example seems like very confusing text to
include in an introduction to `interactive'.  The failure modes (if you
can call it that) are hyper-specific to a very obscure case, and (as
Drew says) what the user should do here depends on what the user wants.

So I think that bit should just be removed from the manual.

Any objections?

----

@item
It may be a Lisp expression that is not a string; then it should be a
form that is evaluated to get a list of arguments to pass to the
command.  Usually this form will call various functions to read input
from the user, most often through the minibuffer (@pxref{Minibuffers})
or directly from the keyboard (@pxref{Reading Input}).

Providing point or the mark as an argument value is also common, but
if you do this @emph{and} read input (whether using the minibuffer or
not), be sure to get the integer values of point or the mark after
reading.  The current buffer may be receiving subprocess output; if
subprocess output arrives while the command is waiting for input, it
could relocate point and the mark.

Here's an example of what @emph{not} to do:

@smallexample
(interactive
 (list (region-beginning) (region-end)
       (read-string "Foo: " nil 'my-history)))
@end smallexample

@noindent
Here's how to avoid the problem, by examining point and the mark after
reading the keyboard input:

@smallexample
(interactive
 (let ((string (read-string "Foo: " nil 'my-history)))
   (list (region-beginning) (region-end) string)))
@end smallexample

----

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2019-08-04 12:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-14 15:50 bug#17779: 24.4.50; (elisp) `Using Interactive' Drew Adams
2019-08-04 12:41 ` Lars Ingebrigtsen [this message]
2019-08-04 17:13   ` Eli Zaretskii
2019-08-05  9:29     ` Lars Ingebrigtsen
2019-08-05 16:25       ` Eli Zaretskii
2019-08-05  2:05   ` Drew Adams
2019-08-06  3:20     ` Richard Stallman

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=87o9159k6k.fsf@mouse.gnus.org \
    --to=larsi@gnus.org \
    --cc=17779@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /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.