X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/4787a496a05fdc03241850b45911dd283d4b06b8..d7306fe6b15ccdc49a066c05e5e86df8e005e859:/src/callint.c diff --git a/src/callint.c b/src/callint.c index 467790ce6c..a9f8f23146 100644 --- a/src/callint.c +++ b/src/callint.c @@ -1,6 +1,6 @@ /* Call a Lisp function interactively. Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008 + 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -20,6 +20,7 @@ along with GNU Emacs. If not, see . */ #include +#include #include "lisp.h" #include "buffer.h" @@ -42,15 +43,17 @@ Lisp_Object Vcommand_history; extern Lisp_Object Vhistory_length; extern Lisp_Object Vthis_original_command, real_this_command; +extern int history_delete_duplicates; Lisp_Object Vcommand_debug_status, Qcommand_debug_status; Lisp_Object Qenable_recursive_minibuffers; +extern Lisp_Object Qface, Qminibuffer_prompt; /* Non-nil means treat the mark as active even if mark_active is 0. */ Lisp_Object Vmark_even_if_inactive; -Lisp_Object Vshift_select_mode, Qhandle_shift_selection; +Lisp_Object Qhandle_shift_selection; Lisp_Object Vmouse_leave_buffer_hook, Qmouse_leave_buffer_hook; @@ -67,18 +70,19 @@ static Lisp_Object callint_message; DEFUN ("interactive", Finteractive, Sinteractive, 0, UNEVALLED, 0, doc: /* Specify a way of parsing arguments for interactive use of a function. For example, write - (defun foo (arg) "Doc string" (interactive "p") ...use arg...) -to make ARG be the prefix argument when `foo' is called as a command. + (defun foo (arg buf) "Doc string" (interactive "P\\nbbuffer: ") .... ) + to make ARG be the raw prefix argument, and set BUF to an existing buffer, + when `foo' is called as a command. The "call" to `interactive' is actually a declaration rather than a function; it tells `call-interactively' how to read arguments to pass to the function. When actually called, `interactive' just returns nil. -The argument of `interactive' is usually a string containing a code letter - followed by a prompt. (Some code letters do not use I/O to get - the argument and do not need prompts.) To prompt for multiple arguments, - give a code letter, its prompt, a newline, and another code letter, etc. - Prompts are passed to format, and may use % escapes to print the +Usually the argument of `interactive' is a string containing a code letter + followed optionally by a prompt. (Some code letters do not use I/O to get + the argument and do not use prompts.) To get several arguments, concatenate + the individual strings, separating them by newline characters. +Prompts are passed to format, and may use % escapes to print the arguments that have already been read. If the argument is not a string, it is evaluated to get a list of arguments to pass to the function. @@ -126,7 +130,7 @@ If the string begins with `^' and `shift-select-mode' is non-nil, Emacs first calls the function `handle-shift-select'. You may use `@', `*', and `^' together. They are processed in the order that they appear, before reading any arguments. -usage: (interactive ARGS) */) +usage: (interactive &optional ARGS) */) (args) Lisp_Object args; { @@ -364,12 +368,15 @@ invoke it. If KEYS is omitted or nil, the return value of { /* We should record this command on the command history. */ Lisp_Object values; + Lisp_Object this_cmd; /* Make a copy of the list of values, for the command history, and turn them into things we can eval. */ values = quotify_args (Fcopy_sequence (specs)); fix_command (input, values); - Vcommand_history - = Fcons (Fcons (function, values), Vcommand_history); + this_cmd = Fcons (function, values); + if (history_delete_duplicates) + Vcommand_history = Fdelete (this_cmd, Vcommand_history); + Vcommand_history = Fcons (this_cmd, Vcommand_history); /* Don't keep command history around forever. */ if (INTEGERP (Vhistory_length) && XINT (Vhistory_length) > 0) @@ -452,14 +459,7 @@ invoke it. If KEYS is omitted or nil, the return value of } else if (*string == '^') { - if (! NILP (Vshift_select_mode)) - call1 (Qhandle_shift_selection, Qnil); - /* Even if shift-select-mode is off, temporarily active - regions could be set using the mouse, and should be - deactivated. */ - else if (CONSP (Vtransient_mark_mode) - && EQ (XCAR (Vtransient_mark_mode), Qonly)) - call1 (Qhandle_shift_selection, Qt); + call0 (Qhandle_shift_selection); string++; } else break; @@ -541,6 +541,10 @@ invoke it. If KEYS is omitted or nil, the return value of break; case 'c': /* Character */ + /* Prompt in `minibuffer-prompt' face. */ + Fput_text_property (make_number (0), + make_number (SCHARS (callint_message)), + Qface, Qminibuffer_prompt, callint_message); args[i] = Fread_char (callint_message, Qnil, Qnil); message1_nolog ((char *) 0); /* Passing args[i] directly stimulates compiler bug */ @@ -594,6 +598,10 @@ invoke it. If KEYS is omitted or nil, the return value of { int speccount1 = SPECPDL_INDEX (); specbind (Qcursor_in_echo_area, Qt); + /* Prompt in `minibuffer-prompt' face. */ + Fput_text_property (make_number (0), + make_number (SCHARS (callint_message)), + Qface, Qminibuffer_prompt, callint_message); args[i] = Fread_key_sequence (callint_message, Qnil, Qnil, Qnil, Qnil); unbind_to (speccount1, Qnil); @@ -622,6 +630,10 @@ invoke it. If KEYS is omitted or nil, the return value of { int speccount1 = SPECPDL_INDEX (); specbind (Qcursor_in_echo_area, Qt); + /* Prompt in `minibuffer-prompt' face. */ + Fput_text_property (make_number (0), + make_number (SCHARS (callint_message)), + Qface, Qminibuffer_prompt, callint_message); args[i] = Fread_key_sequence (callint_message, Qnil, Qt, Qnil, Qnil); teml = args[i]; @@ -980,20 +992,6 @@ turns off region highlighting, but commands that use the mark behave as if the mark were still active. */); Vmark_even_if_inactive = Qt; - DEFVAR_LISP ("shift-select-mode", &Vshift_select_mode, - doc: /* When non-nil, shifted motion keys activate the mark momentarily. - -While the mark is activated in this way, any shift-translated point -motion key extends the region, and if Transient Mark mode was off, it -is temporarily turned on. Furthermore, the mark will be deactivated -by any subsequent point motion key that was not shift-translated, or -by any action that normally deactivates the mark in Transient Mark -mode. - -See `this-command-keys-shift-translated' for the meaning of -shift-translation. */); - Vshift_select_mode = Qt; - DEFVAR_LISP ("mouse-leave-buffer-hook", &Vmouse_leave_buffer_hook, doc: /* Hook to run when about to switch windows with a mouse command. Its purpose is to give temporary modes such as Isearch mode