From: Richard Stallman <rms@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: this-command oddness
Date: Fri, 29 Aug 2003 11:53:10 -0400 [thread overview]
Message-ID: <E19slYk-0006zB-UQ@fencepost.gnu.org> (raw)
In-Reply-To: <41wuczmmjc.fsf@obel19.ida.liu.se> (message from David Byers on 27 Aug 2003 12:18:15 +0200)
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.
That is because the last command read and executed by Emacs was
exit-minibuffer.
I guess you implicitly expected completing-read to save and restore
these values, but it does not. I don't think that is a bug.
If you call the function explicitly, the responsibility to manage
these values is yours.
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).
That could be a real bug. Here is a patch to change it; could you
try it and report if it causes any problems?
*** callint.c.~1.126.~ Sun May 18 08:28:18 2003
--- callint.c Thu Aug 28 12:59:24 2003
***************
*** 41,46 ****
--- 41,47 ----
Lisp_Object Vcommand_history;
extern Lisp_Object Vhistory_length;
+ extern Lisp_Object Vthis_original_command, real_this_command;
Lisp_Object Vcommand_debug_status, Qcommand_debug_status;
Lisp_Object Qenable_recursive_minibuffers;
***************
*** 291,296 ****
--- 292,305 ----
int key_count;
int record_then_fail = 0;
+ Lisp_Object save_this_command, save_last_command;
+ Lisp_Object save_this_original_command, save_real_this_command;
+
+ save_this_command = Vthis_command;
+ save_this_original_command = Vthis_original_command;
+ save_real_this_command = real_this_command;
+ save_last_command = current_kboard->Vlast_command;
+
if (NILP (keys))
keys = this_command_keys, key_count = this_command_key_count;
else
***************
*** 395,400 ****
--- 404,415 ----
XSETCDR (teml, Qnil);
}
}
+
+ Vthis_command = save_this_command;
+ Vthis_original_command = save_this_original_command;
+ real_this_command= save_real_this_command;
+ current_kboard->Vlast_command = save_last_command;
+
single_kboard_state ();
return apply1 (function, specs);
}
***************
*** 840,845 ****
--- 855,865 ----
if (record_then_fail)
Fbarf_if_buffer_read_only ();
+
+ Vthis_command = save_this_command;
+ Vthis_original_command = save_this_original_command;
+ real_this_command= save_real_this_command;
+ current_kboard->Vlast_command = save_last_command;
single_kboard_state ();
prev parent reply other threads:[~2003-08-29 15:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-27 10:18 this-command oddness David Byers
2003-08-29 15:53 ` Richard Stallman [this message]
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=E19slYk-0006zB-UQ@fencepost.gnu.org \
--to=rms@gnu.org \
--cc=emacs-devel@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.