* Re: this-command oddness
[not found] <41wuczmmjc.fsf@obel19.ida.liu.se>
@ 2003-08-29 15:53 ` Richard Stallman
0 siblings, 0 replies; only message in thread
From: Richard Stallman @ 2003-08-29 15:53 UTC (permalink / raw)
Cc: emacs-devel
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 ();
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-08-29 15:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <41wuczmmjc.fsf@obel19.ida.liu.se>
2003-08-29 15:53 ` this-command oddness Richard Stallman
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).