all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Byers <davby@ida.liu.se>
Subject: this-command oddness
Date: 27 Aug 2003 12:18:15 +0200	[thread overview]
Message-ID: <41wuczmmjc.fsf@obel19.ida.liu.se> (raw)

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.2.1 (sparc-sun-solaris2.8, X toolkit)
 of 2002-03-18 on sen14.ida.liu.se
configured using `configure  --prefix=/pkg/emacs-21.2 --with-xpm --with-jpeg --with-tiff --with-gif --with-png --with-x'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: en_US.ISO8859-1
  value of $LC_CTYPE: iso_8859_1
  value of $LC_MESSAGES: C
  value of $LC_MONETARY: en_US.ISO8859-1
  value of $LC_NUMERIC: en_US.ISO8859-1
  value of $LC_TIME: en_US.ISO8859-1
  value of $LANG: en_US
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:


In the following command:

    (defun db--test-this-command (file)
       (interactive)
       (completing-read "Hit RET: " nil)
       (message "%S" this-command))

I expected the message "db--test-this-command" in the echo area.
Instead I get "exit-minibuffer". Furthermore, last-command becomes
bound to exit-minibuffer rather than db--test-this-command. 

Similarly, in the following command:

    (defun db--test-this-command (file)
       (interactive "f")
       (message "%S" this-command))

I expected the message "db--test-this-command" in the echo area.
Instead I get "minibuffer-complete-and-exit" (after entering a file
name).

The value of this-command in a post-command-hook that is run after one
of the examples above will be "minibuffer-complete-and-exit or
"exit-minibuffer" or rather than "db--test-this-command". Similarly,
the value of last-command is affected.

I assume that this is the result of completing-read interactively
reading characters from the user, re-binding this-command in the
process.

In my opinion, neither completing-read, nor read-from-minibuffer
should alter this-command. I *definitely* think that interactive
should not alter this-command, regardless of what it calls in turn (if
this-command is altered in the call to interactive, the command never
gets a chance to examine the original value of this-command).


I propose that one of the following changes be made:

* Alter completing-read and read-from-minibuffer so they save the
  value of this-command on entry and restore it on exit or at least
  alter interactive so it saves the value of this-command on entry and
  restores it on exit.

* Update the documentation of this-command and last-command to reflect
  the face that they may not behave as expected. Examples like those I
  have shown would be appropriate in the elisp manual. Update the
  documentation for post-command-hook to indicate that this-command
  may have been inadvertently altered by the command that ran last.

I would have submitted patches, but don't have the time to write them
at the moment. Sorry.

-- 
David Byers.

             reply	other threads:[~2003-08-27 10:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-27 10:18 David Byers [this message]
2003-08-29 15:53 ` this-command oddness 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=41wuczmmjc.fsf@obel19.ida.liu.se \
    --to=davby@ida.liu.se \
    /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.