428
+ − 1 /* Call a Lisp function interactively.
+ − 2 Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc.
793
+ − 3 Copyright (C) 1995, 1996, 2001, 2002 Ben Wing.
428
+ − 4
+ − 5 This file is part of XEmacs.
+ − 6
+ − 7 XEmacs is free software; you can redistribute it and/or modify it
+ − 8 under the terms of the GNU General Public License as published by the
+ − 9 Free Software Foundation; either version 2, or (at your option) any
+ − 10 later version.
+ − 11
+ − 12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
+ − 13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ − 14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ − 15 for more details.
+ − 16
+ − 17 You should have received a copy of the GNU General Public License
+ − 18 along with XEmacs; see the file COPYING. If not, write to
+ − 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ − 20 Boston, MA 02111-1307, USA. */
+ − 21
+ − 22 /* Synched up with: FSF 19.30, Mule 2.0. */
+ − 23
+ − 24 /* Authorship:
+ − 25
+ − 26 FSF: long ago.
+ − 27 Mly or JWZ: various changes.
+ − 28 */
+ − 29
+ − 30 #include <config.h>
+ − 31 #include "lisp.h"
+ − 32
+ − 33 #include "buffer.h"
+ − 34 #include "bytecode.h"
+ − 35 #include "commands.h"
+ − 36 #include "events.h"
+ − 37 #include "insdel.h"
+ − 38 #include "window.h"
+ − 39
+ − 40 extern int num_input_chars;
+ − 41
+ − 42 Lisp_Object Vcurrent_prefix_arg;
+ − 43 Lisp_Object Qcall_interactively;
+ − 44 Lisp_Object Vcommand_history;
+ − 45
+ − 46 Lisp_Object Vcommand_debug_status, Qcommand_debug_status;
+ − 47 Lisp_Object Qenable_recursive_minibuffers;
+ − 48
+ − 49 #if 0 /* FSFmacs */
+ − 50 /* Non-nil means treat the mark as active
+ − 51 even if mark_active is 0. */
+ − 52 Lisp_Object Vmark_even_if_inactive;
+ − 53 #endif
+ − 54
+ − 55 #if 0 /* ill-conceived */
444
+ − 56 /* FSF calls Qmouse_leave_buffer_hook at all sorts of random places,
+ − 57 including a bunch of places in their mouse.el. If this is
+ − 58 implemented, it has to be done cleanly. */
428
+ − 59 Lisp_Object Vmouse_leave_buffer_hook, Qmouse_leave_buffer_hook;
+ − 60 #endif
+ − 61
442
+ − 62 Lisp_Object QletX, Qsave_excursion;
428
+ − 63
+ − 64 Lisp_Object Qread_from_minibuffer;
+ − 65 Lisp_Object Qread_file_name;
+ − 66 Lisp_Object Qread_directory_name;
+ − 67 Lisp_Object Qcompleting_read;
+ − 68 Lisp_Object Qread_buffer;
+ − 69 Lisp_Object Qread_function;
+ − 70 Lisp_Object Qread_variable;
+ − 71 Lisp_Object Qread_expression;
+ − 72 Lisp_Object Qread_command;
+ − 73 Lisp_Object Qread_number;
+ − 74 Lisp_Object Qread_string;
+ − 75 Lisp_Object Qevents_to_keys;
+ − 76
+ − 77 Lisp_Object Qread_coding_system;
+ − 78 Lisp_Object Qread_non_nil_coding_system;
+ − 79
+ − 80 /* ARGSUSED */
+ − 81 DEFUN ("interactive", Finteractive, 0, UNEVALLED, 0, /*
+ − 82 Specify a way of parsing arguments for interactive use of a function.
+ − 83 For example, write
+ − 84 (defun foo (arg) "Doc string" (interactive "p") ...use arg...)
+ − 85 to make ARG be the prefix argument when `foo' is called as a command.
+ − 86 The "call" to `interactive' is actually a declaration rather than a function;
+ − 87 it tells `call-interactively' how to read arguments
+ − 88 to pass to the function.
+ − 89 When actually called, `interactive' just returns nil.
+ − 90
+ − 91 The argument of `interactive' is usually a string containing a code letter
+ − 92 followed by a prompt. (Some code letters do not use I/O to get
+ − 93 the argument and do not need prompts.) To prompt for multiple arguments,
+ − 94 give a code letter, its prompt, a newline, and another code letter, etc.
+ − 95 Prompts are passed to format, and may use % escapes to print the
+ − 96 arguments that have already been read.
+ − 97 If the argument is not a string, it is evaluated to get a list of
+ − 98 arguments to pass to the function.
+ − 99 Just `(interactive)' means pass no args when calling interactively.
+ − 100
+ − 101 Code letters available are:
+ − 102 a -- Function name: symbol with a function definition.
+ − 103 b -- Name of existing buffer.
+ − 104 B -- Name of buffer, possibly nonexistent.
+ − 105 c -- Character.
+ − 106 C -- Command name: symbol with interactive function definition.
+ − 107 d -- Value of point as number. Does not do I/O.
+ − 108 D -- Directory name.
+ − 109 e -- Last mouse-button or misc-user event that invoked this command.
+ − 110 If used more than once, the Nth `e' returns the Nth such event.
+ − 111 Does not do I/O.
+ − 112 f -- Existing file name.
+ − 113 F -- Possibly nonexistent file name.
+ − 114 i -- Always nil, ignore. Use to skip arguments when interactive.
+ − 115 k -- Key sequence (a vector of events).
+ − 116 K -- Key sequence to be redefined (do not automatically down-case).
+ − 117 m -- Value of mark as number. Does not do I/O.
+ − 118 n -- Number read using minibuffer.
+ − 119 N -- Prefix arg converted to number, or if none, do like code `n'.
+ − 120 p -- Prefix arg converted to number. Does not do I/O.
+ − 121 P -- Prefix arg in raw form. Does not do I/O.
+ − 122 r -- Region: point and mark as 2 numeric args, smallest first. Does no I/O.
+ − 123 s -- Any string.
+ − 124 S -- Any symbol.
+ − 125 v -- Variable name: symbol that is user-variable-p.
+ − 126 x -- Lisp expression read but not evaluated.
+ − 127 X -- Lisp expression read and evaluated.
+ − 128 z -- Coding system. (Always nil if no Mule support.)
+ − 129 Z -- Coding system, nil if no prefix arg. (Always nil if no Mule support.)
+ − 130 In addition, if the string begins with `*'
+ − 131 then an error is signaled if the buffer is read-only.
+ − 132 This happens before reading any arguments.
+ − 133 If the string begins with `@', then the window the mouse is over is selected
+ − 134 before anything else is done.
+ − 135 If the string begins with `_', then this command will not cause the region
+ − 136 to be deactivated when it completes; that is, `zmacs-region-stays' will be
+ − 137 set to t when the command exits successfully.
+ − 138 You may use any of `@', `*' and `_' at the beginning of the string;
+ − 139 they are processed in the order that they appear.
502
+ − 140
+ − 141
+ − 142 When writing your own interactive spec, it can be useful to know the
+ − 143 equivalent Lisp expressions for the various code letters. They are:
+ − 144
+ − 145 a -- (read-function "PROMPT")
+ − 146 b -- (let ((def (current-buffer)))
+ − 147 (if (eq (selected-window) (active-minibuffer-window))
+ − 148 (setq def (other-buffer def))
+ − 149 (read-buffer "PROMPT" def t)))
+ − 150 B -- (read-buffer "PROMPT" (other-buffer (current-buffer)))
+ − 151 c -- (prog1
+ − 152 (let ((cursor-in-echo-area t))
+ − 153 (message "%s" "PROMPT")
+ − 154 (read-char))
+ − 155 (message nil))
+ − 156 C -- (read-command "PROMPT")
+ − 157 d -- (point)
+ − 158 D -- (read-directory-name "PROMPT" nil default-directory t)
+ − 159 e -- current-mouse-event ;; #### not quite right. needs access to the KEYS
+ − 160 ;; argument of `call-interactively', but that's
+ − 161 ;; currently impossible.
+ − 162 f -- (read-file-name "PROMPT" nil nil 0)
+ − 163 F -- (read-file-name "PROMPT")
+ − 164 i -- nil
+ − 165 k -- (read-key-sequence "PROMPT")
+ − 166 K -- (read-key-sequence "PROMPT" nil t)
+ − 167 m -- (mark)
+ − 168 n -- (read-number "PROMPT")
+ − 169 N -- (if current-prefix-arg
+ − 170 (prefix-numeric-value current-prefix-arg)
+ − 171 (read-number "PROMPT"))
+ − 172 p -- (prefix-numeric-value current-prefix-arg)
+ − 173 P -- current-prefix-arg
+ − 174 r -- (if (and zmacs-regions (not zmacs-region-active-p))
+ − 175 (error "The region is not active now"))
+ − 176 (let ((tem (marker-buffer (mark-marker t))))
+ − 177 (unless (and tem (eq tem (current-buffer)))
+ − 178 (error "The mark is now set now")))
+ − 179 (region-beginning) +
+ − 180 (region-end)
+ − 181 s -- (read-string "PROMPT")
+ − 182 S -- (let (tem prev-tem)
+ − 183 (while (not tem)
+ − 184 (setq tem (completing-read "PROMPT" obarray nil nil prev-tem))
+ − 185 (setq prev-tem tem)
+ − 186 (setq tem (intern tem))
+ − 187 (if (= (length tem) 0)
+ − 188 (setq tem nil))))
+ − 189 v -- (read-variable "PROMPT")
+ − 190 x -- (read-expression "PROMPT")
+ − 191 X -- (eval (read-expression "PROMPT"))
+ − 192 z -- (and (fboundp 'read-coding-system) (read-coding-system "PROMPT"))
+ − 193 Z -- (and current-prefix-arg (fboundp 'read-coding-system)
+ − 194 (read-coding-system "PROMPT"))
+ − 195
+ − 196 `*' (barf-if-buffer-read-only)
+ − 197 `@' (let ((event current-mouse-event)) ;; #### not quite right; needs the
+ − 198 (when event ;; value from the `e' spec above.
+ − 199 (let ((window event-window event))
+ − 200 (when window
+ − 201 (if (and (window-minibuffer-p window)
+ − 202 (not (and (> (minibuffer-depth) 0)
+ − 203 (eq window (active-minibuffer-window)))))
+ − 204 (error "Attempt to select inactive minibuffer window"))
+ − 205 (select window)))))
+ − 206 `_' (setq zmacs-region-stays t)
+ − 207
428
+ − 208 */
+ − 209 (args))
+ − 210 {
+ − 211 return Qnil;
+ − 212 }
+ − 213
+ − 214 /* Originally, this was just a function -- but `custom' used a
+ − 215 garden-variety version, so why not make it a subr? */
+ − 216 /* #### Move it to another file! */
+ − 217 DEFUN ("quote-maybe", Fquote_maybe, 1, 1, 0, /*
+ − 218 Quote EXPR if it is not self quoting.
+ − 219 */
+ − 220 (expr))
+ − 221 {
+ − 222 return ((NILP (expr)
+ − 223 || EQ (expr, Qt)
+ − 224 || INTP (expr)
+ − 225 || FLOATP (expr)
+ − 226 || CHARP (expr)
+ − 227 || STRINGP (expr)
+ − 228 || VECTORP (expr)
+ − 229 || KEYWORDP (expr)
+ − 230 || BIT_VECTORP (expr)
+ − 231 || (CONSP (expr) && EQ (XCAR (expr), Qlambda)))
+ − 232 ? expr : list2 (Qquote, expr));
+ − 233 }
+ − 234
+ − 235 /* Modify EXPR by quotifying each element (except the first). */
+ − 236 static Lisp_Object
+ − 237 quotify_args (Lisp_Object expr)
+ − 238 {
440
+ − 239 Lisp_Object tail;
+ − 240 Lisp_Cons *ptr;
428
+ − 241 for (tail = expr; CONSP (tail); tail = ptr->cdr)
+ − 242 {
+ − 243 ptr = XCONS (tail);
+ − 244 ptr->car = Fquote_maybe (ptr->car);
+ − 245 }
+ − 246 return expr;
+ − 247 }
+ − 248
665
+ − 249 static Charbpos
428
+ − 250 check_mark (void)
+ − 251 {
+ − 252 Lisp_Object tem;
+ − 253
+ − 254 if (zmacs_regions && !zmacs_region_active_p)
563
+ − 255 invalid_operation ("The region is not active now", Qunbound);
428
+ − 256
+ − 257 tem = Fmarker_buffer (current_buffer->mark);
+ − 258 if (NILP (tem) || (XBUFFER (tem) != current_buffer))
563
+ − 259 invalid_operation ("The mark is not set now", Qunbound);
428
+ − 260
+ − 261 return marker_position (current_buffer->mark);
+ − 262 }
+ − 263
+ − 264 static Lisp_Object
665
+ − 265 callint_prompt (const Intbyte *prompt_start, Bytecount prompt_length,
442
+ − 266 const Lisp_Object *args, int nargs)
428
+ − 267 {
+ − 268 Lisp_Object s = make_string (prompt_start, prompt_length);
+ − 269 struct gcpro gcpro1;
+ − 270
+ − 271 /* Fformat no longer smashes its arg vector, so no need to copy it. */
+ − 272
+ − 273 if (!strchr ((char *) XSTRING_DATA (s), '%'))
+ − 274 return s;
+ − 275 GCPRO1 (s);
771
+ − 276 RETURN_UNGCPRO (emacs_vsprintf_string_lisp (0, s, nargs, args));
428
+ − 277 }
+ − 278
+ − 279 /* `lambda' for RECORD-FLAG is an XEmacs addition. */
+ − 280
+ − 281 DEFUN ("call-interactively", Fcall_interactively, 1, 3, 0, /*
+ − 282 Call FUNCTION, reading args according to its interactive calling specs.
+ − 283 Return the value FUNCTION returns.
+ − 284 The function contains a specification of how to do the argument reading.
+ − 285 In the case of user-defined functions, this is specified by placing a call
+ − 286 to the function `interactive' at the top level of the function body.
+ − 287 See `interactive'.
+ − 288
+ − 289 If optional second arg RECORD-FLAG is the symbol `lambda', the interactive
+ − 290 calling arguments for FUNCTION are read and returned as a list,
+ − 291 but the function is not called on them.
+ − 292
+ − 293 If RECORD-FLAG is `t' then unconditionally put this command in the
+ − 294 command-history. Otherwise, this is done only if an arg is read using
+ − 295 the minibuffer.
+ − 296
+ − 297 The argument KEYS specifies the value to use instead of (this-command-keys)
+ − 298 when reading the arguments.
+ − 299 */
+ − 300 (function, record_flag, keys))
+ − 301 {
+ − 302 /* This function can GC */
+ − 303 int speccount = specpdl_depth ();
+ − 304 Lisp_Object prefix;
+ − 305
+ − 306 Lisp_Object fun;
+ − 307 Lisp_Object specs = Qnil;
+ − 308 #ifdef IT_SEEMS_THAT_MLY_DOESNT_LIKE_THIS
+ − 309 Lisp_Object enable;
+ − 310 #endif
793
+ − 311 /* If SPECS is a string, we reset prompt_data to XSTRING_DATA (specs)
+ − 312 every time a GC might have occurred */
442
+ − 313 const char *prompt_data = 0;
428
+ − 314 int prompt_index = 0;
+ − 315 int argcount;
+ − 316 int set_zmacs_region_stays = 0;
+ − 317 int mouse_event_count = 0;
+ − 318
+ − 319 if (!NILP (keys))
+ − 320 {
+ − 321 int i, len;
+ − 322
+ − 323 CHECK_VECTOR (keys);
+ − 324 len = XVECTOR_LENGTH (keys);
+ − 325 for (i = 0; i < len; i++)
+ − 326 CHECK_LIVE_EVENT (XVECTOR_DATA (keys)[i]);
+ − 327 }
+ − 328
+ − 329 /* Save this now, since use of minibuffer will clobber it. */
+ − 330 prefix = Vcurrent_prefix_arg;
+ − 331
+ − 332 retry:
+ − 333
+ − 334 #ifdef IT_SEEMS_THAT_MLY_DOESNT_LIKE_THIS
+ − 335 /* Marginal kludge. Use an evaluated interactive spec instead of this! */
+ − 336 if (SYMBOLP (function))
+ − 337 enable = Fget (function, Qenable_recursive_minibuffers, Qnil);
+ − 338 #endif
+ − 339
+ − 340 fun = indirect_function (function, 1);
+ − 341
+ − 342 /* Decode the kind of function. Either handle it and return,
+ − 343 or go to `lose' if not interactive, or go to `retry'
+ − 344 to specify a different function, or set either PROMPT_DATA or SPECS. */
+ − 345
+ − 346 if (SUBRP (fun))
+ − 347 {
+ − 348 prompt_data = XSUBR (fun)->prompt;
+ − 349 if (!prompt_data)
+ − 350 {
+ − 351 lose:
+ − 352 function = wrong_type_argument (Qcommandp, function);
+ − 353 goto retry;
+ − 354 }
+ − 355 #if 0 /* FSFmacs */ /* Huh? Where is this used? */
+ − 356 if ((EMACS_INT) prompt_data == 1)
+ − 357 /* Let SPECS (which is nil) be used as the args. */
+ − 358 prompt_data = 0;
+ − 359 #endif
+ − 360 }
+ − 361 else if (COMPILED_FUNCTIONP (fun))
+ − 362 {
+ − 363 Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (fun);
+ − 364 if (! f->flags.interactivep)
+ − 365 goto lose;
+ − 366 specs = compiled_function_interactive (f);
+ − 367 }
+ − 368 else if (!CONSP (fun))
+ − 369 goto lose;
+ − 370 else
+ − 371 {
+ − 372 Lisp_Object funcar = Fcar (fun);
+ − 373
+ − 374 if (EQ (funcar, Qautoload))
+ − 375 {
+ − 376 struct gcpro gcpro1, gcpro2;
+ − 377 GCPRO2 (function, prefix);
+ − 378 do_autoload (fun, function);
+ − 379 UNGCPRO;
+ − 380 goto retry;
+ − 381 }
+ − 382 else if (EQ (funcar, Qlambda))
+ − 383 {
+ − 384 specs = Fassq (Qinteractive, Fcdr (Fcdr (fun)));
+ − 385 if (NILP (specs))
+ − 386 goto lose;
+ − 387 specs = Fcar (Fcdr (specs));
+ − 388 }
+ − 389 else
+ − 390 goto lose;
+ − 391 }
+ − 392
851
+ − 393 /* FSFmacs makes an ALLOCA () copy of prompt_data here.
428
+ − 394 We're more intelligent about this and just reset prompt_data
+ − 395 as necessary. */
+ − 396 /* If either specs or prompt_data is set to a string, use it. */
+ − 397 if (!STRINGP (specs) && prompt_data == 0)
+ − 398 {
+ − 399 struct gcpro gcpro1, gcpro2, gcpro3;
+ − 400 int i = num_input_chars;
+ − 401 Lisp_Object input = specs;
+ − 402
+ − 403 GCPRO3 (function, specs, input);
+ − 404 /* Compute the arg values using the user's expression. */
+ − 405 specs = Feval (specs);
+ − 406 if (EQ (record_flag, Qlambda)) /* XEmacs addition */
+ − 407 {
+ − 408 UNGCPRO;
+ − 409 return specs;
+ − 410 }
+ − 411 if (!NILP (record_flag) || i != num_input_chars)
+ − 412 {
+ − 413 /* We should record this command on the command history. */
+ − 414 /* #### The following is too specific; should have general
+ − 415 mechanism for doing this. */
+ − 416 Lisp_Object values, car;
+ − 417 /* Make a copy of the list of values, for the command history,
+ − 418 and turn them into things we can eval. */
+ − 419 values = quotify_args (Fcopy_sequence (specs));
+ − 420 /* If the list of args was produced with an explicit call to `list',
+ − 421 look for elements that were computed with (region-beginning)
+ − 422 or (region-end), and put those expressions into VALUES
+ − 423 instead of the present values. */
+ − 424 if (CONSP (input))
+ − 425 {
+ − 426 car = XCAR (input);
+ − 427 /* Skip through certain special forms. */
+ − 428 while (EQ (car, Qlet) || EQ (car, QletX)
+ − 429 || EQ (car, Qsave_excursion))
+ − 430 {
+ − 431 while (CONSP (XCDR (input)))
+ − 432 input = XCDR (input);
+ − 433 input = XCAR (input);
+ − 434 if (!CONSP (input))
+ − 435 break;
+ − 436 car = XCAR (input);
+ − 437 }
+ − 438 if (EQ (car, Qlist))
+ − 439 {
+ − 440 Lisp_Object intail, valtail;
+ − 441 for (intail = Fcdr (input), valtail = values;
+ − 442 CONSP (valtail);
+ − 443 intail = Fcdr (intail), valtail = Fcdr (valtail))
+ − 444 {
+ − 445 Lisp_Object elt;
+ − 446 elt = Fcar (intail);
+ − 447 if (CONSP (elt))
+ − 448 {
+ − 449 Lisp_Object eltcar = Fcar (elt);
+ − 450 if (EQ (eltcar, Qpoint) ||
+ − 451 EQ (eltcar, Qmark) ||
+ − 452 EQ (eltcar, Qregion_beginning) ||
+ − 453 EQ (eltcar, Qregion_end))
+ − 454 Fsetcar (valtail, Fcar (intail));
+ − 455 }
+ − 456 }
+ − 457 }
+ − 458 }
+ − 459 Vcommand_history
+ − 460 = Fcons (Fcons (function, values), Vcommand_history);
+ − 461 }
+ − 462 single_console_state ();
+ − 463 RETURN_UNGCPRO (apply1 (fun, specs));
+ − 464 }
+ − 465
+ − 466 /* Here if function specifies a string to control parsing the defaults */
+ − 467
+ − 468 #ifdef I18N3
+ − 469 /* Translate interactive prompt. */
+ − 470 if (STRINGP (specs))
+ − 471 {
+ − 472 Lisp_Object domain = Qnil;
+ − 473 if (COMPILED_FUNCTIONP (fun))
+ − 474 domain = compiled_function_domain (XCOMPILED_FUNCTION (fun));
+ − 475 if (NILP (domain))
+ − 476 specs = Fgettext (specs);
+ − 477 else
+ − 478 specs = Fdgettext (domain, specs);
+ − 479 }
+ − 480 else if (prompt_data)
+ − 481 /* We do not have to worry about domains in this case because
+ − 482 prompt_data is non-nil only for built-in functions, which
+ − 483 always use the default domain. */
+ − 484 prompt_data = gettext (prompt_data);
+ − 485 #endif
+ − 486
+ − 487 /* Handle special starting chars `*' and `@' and `_'. */
+ − 488 /* Note that `+' is reserved for user extensions. */
+ − 489 prompt_index = 0;
+ − 490 {
+ − 491 struct gcpro gcpro1, gcpro2;
+ − 492 GCPRO2 (function, specs);
+ − 493
+ − 494 for (;;)
+ − 495 {
+ − 496 if (STRINGP (specs))
442
+ − 497 prompt_data = (const char *) XSTRING_DATA (specs);
428
+ − 498
+ − 499 if (prompt_data[prompt_index] == '+')
563
+ − 500 syntax_error ("`+' is not used in `interactive' for ordinary commands", Qunbound);
428
+ − 501 else if (prompt_data[prompt_index] == '*')
+ − 502 {
+ − 503 prompt_index++;
+ − 504 if (!NILP (current_buffer->read_only))
+ − 505 barf_if_buffer_read_only (current_buffer, -1, -1);
+ − 506 }
+ − 507 else if (prompt_data[prompt_index] == '@')
+ − 508 {
+ − 509 Lisp_Object event;
+ − 510 prompt_index++;
+ − 511
+ − 512 if (!NILP (keys))
+ − 513 event = extract_vector_nth_mouse_event (keys, 0);
+ − 514 else
+ − 515 #if 0
+ − 516 event = extract_this_command_keys_nth_mouse_event (0);
+ − 517 #else
+ − 518 /* Doesn't work; see below */
+ − 519 event = Vcurrent_mouse_event;
+ − 520 #endif
+ − 521 if (! NILP (event))
+ − 522 {
+ − 523 Lisp_Object window = Fevent_window (event);
+ − 524 if (!NILP (window))
+ − 525 {
+ − 526 if (MINI_WINDOW_P (XWINDOW (window))
+ − 527 && ! (minibuf_level > 0 && EQ (window,
+ − 528 minibuf_window)))
563
+ − 529 invalid_operation ("Attempt to select inactive minibuffer window", Qunbound);
428
+ − 530
+ − 531 #if 0 /* unclean! see event-stream.c */
+ − 532 /* If the current buffer wants to clean up, let it. */
+ − 533 if (!NILP (Vmouse_leave_buffer_hook))
+ − 534 run_hook (Qmouse_leave_buffer_hook);
+ − 535 #endif
+ − 536
+ − 537 Fselect_window (window, Qnil);
+ − 538 }
+ − 539 }
+ − 540 }
+ − 541 else if (prompt_data[prompt_index] == '_')
+ − 542 {
+ − 543 prompt_index++;
+ − 544 set_zmacs_region_stays = 1;
+ − 545 }
+ − 546 else
+ − 547 {
+ − 548 UNGCPRO;
+ − 549 break;
+ − 550 }
+ − 551 }
+ − 552 }
+ − 553
+ − 554 /* Count the number of arguments the interactive spec would have
+ − 555 us give to the function. */
+ − 556 argcount = 0;
+ − 557 {
442
+ − 558 const char *tem;
428
+ − 559 for (tem = prompt_data + prompt_index; *tem; )
+ − 560 {
+ − 561 /* 'r' specifications ("point and mark as 2 numeric args")
+ − 562 produce *two* arguments. */
+ − 563 if (*tem == 'r')
+ − 564 argcount += 2;
+ − 565 else
+ − 566 argcount += 1;
442
+ − 567 tem = (const char *) strchr (tem + 1, '\n');
428
+ − 568 if (!tem)
+ − 569 break;
+ − 570 tem++;
+ − 571 }
+ − 572 }
+ − 573
+ − 574 #ifdef IT_SEEMS_THAT_MLY_DOESNT_LIKE_THIS
+ − 575 if (!NILP (enable))
+ − 576 specbind (Qenable_recursive_minibuffers, Qt);
+ − 577 #endif
+ − 578
+ − 579 if (argcount == 0)
+ − 580 {
+ − 581 /* Interactive function or no arguments; just call it */
+ − 582 if (EQ (record_flag, Qlambda))
+ − 583 return Qnil;
+ − 584 if (!NILP (record_flag))
+ − 585 {
+ − 586 Vcommand_history = Fcons (list1 (function), Vcommand_history);
+ − 587 }
+ − 588 specbind (Qcommand_debug_status, Qnil);
+ − 589 /* XEmacs: was fun = call0 (fun), but that's backtraced wrong */
+ − 590 {
+ − 591 struct gcpro gcpro1;
+ − 592
+ − 593 GCPRO1 (fun);
+ − 594 fun = Ffuncall (1, &fun);
+ − 595 UNGCPRO;
+ − 596 }
+ − 597 if (set_zmacs_region_stays)
+ − 598 zmacs_region_stays = 1;
771
+ − 599 return unbind_to_1 (speccount, fun);
428
+ − 600 }
+ − 601
+ − 602 /* Read interactive arguments */
+ − 603 {
+ − 604 /* args[-1] is the function to call */
+ − 605 /* args[n] is the n'th argument to the function */
+ − 606 int alloca_size = (1 /* function to call */
+ − 607 + argcount /* actual arguments */
+ − 608 + argcount /* visargs */
+ − 609 + argcount /* varies */
+ − 610 );
+ − 611 Lisp_Object *args = alloca_array (Lisp_Object, alloca_size) + 1;
+ − 612 /* visargs is an array of either Qnil or user-friendlier versions (often
+ − 613 * strings) of previous arguments, to use in prompts for successive
+ − 614 * arguments. ("Often strings" because emacs didn't used to have
+ − 615 * format %S and prin1-to-string.) */
+ − 616 Lisp_Object *visargs = args + argcount;
+ − 617 /* If varies[i] is non-null, the i'th argument shouldn't just have
+ − 618 its value in this call quoted in the command history. It should be
+ − 619 recorded as a call to the function named varies[i]]. */
+ − 620 Lisp_Object *varies = visargs + argcount;
+ − 621 int arg_from_tty = 0;
+ − 622 REGISTER int argnum;
+ − 623 struct gcpro gcpro1, gcpro2;
+ − 624
+ − 625 args[-1] = function;
+ − 626 for (argnum = 0; argnum < alloca_size - 1; argnum++)
+ − 627 args[argnum] = Qnil;
+ − 628
+ − 629 /* Must GC-protect args[-1] (ie function) because Ffuncall doesn't */
+ − 630 /* `function' itself isn't GC-protected -- use args[-1] from here
+ − 631 (actually, doesn't matter since Emacs GC doesn't relocate, sigh) */
+ − 632 GCPRO2 (prefix, args[-1]);
+ − 633 gcpro2.nvars = alloca_size;
+ − 634
+ − 635 for (argnum = 0; ; argnum++)
+ − 636 {
442
+ − 637 const char *prompt_start = prompt_data + prompt_index + 1;
+ − 638 const char *prompt_limit = (const char *) strchr (prompt_start, '\n');
428
+ − 639 int prompt_length;
+ − 640 prompt_length = ((prompt_limit)
+ − 641 ? (prompt_limit - prompt_start)
664
+ − 642 : (int) strlen (prompt_start));
428
+ − 643 if (prompt_limit && prompt_limit[1] == 0)
+ − 644 {
+ − 645 prompt_limit = 0; /* "sfoo:\n" -- strip tailing return */
+ − 646 prompt_length -= 1;
+ − 647 }
+ − 648 /* This uses `visargs' instead of `args' so that global-set-key
+ − 649 prompts with "Set key C-x C-f to command: "instead of printing
+ − 650 event objects in there.
+ − 651 */
665
+ − 652 #define PROMPT() callint_prompt ((const Intbyte *) prompt_start, prompt_length, visargs, argnum)
428
+ − 653 switch (prompt_data[prompt_index])
+ − 654 {
+ − 655 case 'a': /* Symbol defined as a function */
+ − 656 {
+ − 657 Lisp_Object tem = call1 (Qread_function, PROMPT ());
+ − 658 args[argnum] = tem;
+ − 659 arg_from_tty = 1;
+ − 660 break;
+ − 661 }
+ − 662 case 'b': /* Name of existing buffer */
+ − 663 {
+ − 664 Lisp_Object def = Fcurrent_buffer ();
+ − 665 if (EQ (Fselected_window (Qnil), minibuf_window))
+ − 666 def = Fother_buffer (def, Qnil, Qnil);
+ − 667 /* read-buffer returns a buffer name, not a buffer! */
+ − 668 args[argnum] = call3 (Qread_buffer, PROMPT (), def,
+ − 669 Qt);
+ − 670 arg_from_tty = 1;
+ − 671 break;
+ − 672 }
+ − 673 case 'B': /* Name of buffer, possibly nonexistent */
+ − 674 {
+ − 675 /* read-buffer returns a buffer name, not a buffer! */
+ − 676 args[argnum] = call2 (Qread_buffer, PROMPT (),
+ − 677 Fother_buffer (Fcurrent_buffer (), Qnil,
+ − 678 Qnil));
+ − 679 arg_from_tty = 1;
+ − 680 break;
+ − 681 }
+ − 682 case 'c': /* Character */
+ − 683 {
+ − 684 Lisp_Object tem;
+ − 685 int shadowing_speccount = specpdl_depth ();
+ − 686
+ − 687 specbind (Qcursor_in_echo_area, Qt);
+ − 688 message ("%s", XSTRING_DATA (PROMPT ()));
+ − 689 tem = (call0 (Qread_char));
+ − 690 args[argnum] = tem;
+ − 691 /* visargs[argnum] = Fsingle_key_description (tem); */
+ − 692 /* FSF has visargs[argnum] = Fchar_to_string (tem); */
+ − 693
771
+ − 694 unbind_to (shadowing_speccount);
428
+ − 695
+ − 696 /* #### `C-x / a' should not leave the prompt in the minibuffer.
+ − 697 This isn't the right fix, because (message ...) (read-char)
+ − 698 shouldn't leave the message there either... */
+ − 699 clear_message ();
+ − 700
+ − 701 arg_from_tty = 1;
+ − 702 break;
+ − 703 }
+ − 704 case 'C': /* Command: symbol with interactive function */
+ − 705 {
+ − 706 Lisp_Object tem = call1 (Qread_command, PROMPT ());
+ − 707 args[argnum] = tem;
+ − 708 arg_from_tty = 1;
+ − 709 break;
+ − 710 }
+ − 711 case 'd': /* Value of point. Does not do I/O. */
+ − 712 {
+ − 713 args[argnum] = Fcopy_marker (current_buffer->point_marker, Qt);
+ − 714 varies[argnum] = Qpoint;
+ − 715 break;
+ − 716 }
+ − 717 case 'e':
+ − 718 {
+ − 719 Lisp_Object event;
+ − 720
+ − 721 if (!NILP (keys))
+ − 722 event = extract_vector_nth_mouse_event (keys,
+ − 723 mouse_event_count);
+ − 724 else
+ − 725 #if 0
+ − 726 /* This doesn't quite work because this-command-keys
+ − 727 behaves in utterly counterintuitive ways. Sometimes
+ − 728 it retrieves an event back in the future, e.g. when
+ − 729 one command invokes another command and both are
+ − 730 invoked with the mouse. */
+ − 731 event = (extract_this_command_keys_nth_mouse_event
+ − 732 (mouse_event_count));
+ − 733 #else
+ − 734 event = Vcurrent_mouse_event;
+ − 735 #endif
+ − 736
+ − 737 if (NILP (event))
563
+ − 738 signal_error (Qinvalid_operation,
+ − 739 "function must be bound to a mouse or misc-user event",
+ − 740 function);
428
+ − 741 args[argnum] = event;
+ − 742 mouse_event_count++;
+ − 743 break;
+ − 744 }
+ − 745 case 'D': /* Directory name. */
+ − 746 {
+ − 747 args[argnum] = call4 (Qread_directory_name, PROMPT (),
+ − 748 Qnil, /* dir */
+ − 749 current_buffer->directory, /* default */
+ − 750 Qt /* must-match */
+ − 751 );
+ − 752 arg_from_tty = 1;
+ − 753 break;
+ − 754 }
+ − 755 case 'f': /* Existing file name. */
+ − 756 {
+ − 757 Lisp_Object tem = call4 (Qread_file_name, PROMPT (),
+ − 758 Qnil, /* dir */
+ − 759 Qnil, /* default */
+ − 760 Qzero /* must-match */
+ − 761 );
+ − 762 args[argnum] = tem;
+ − 763 arg_from_tty = 1;
+ − 764 break;
+ − 765 }
+ − 766 case 'F': /* Possibly nonexistent file name. */
+ − 767 {
+ − 768 args[argnum] = call4 (Qread_file_name, PROMPT (),
+ − 769 Qnil, /* dir */
+ − 770 Qnil, /* default */
+ − 771 Qnil /* must-match */
+ − 772 );
+ − 773 arg_from_tty = 1;
+ − 774 break;
+ − 775 }
+ − 776 case 'i': /* Ignore: always nil. Use to skip arguments. */
+ − 777 {
+ − 778 args[argnum] = Qnil;
+ − 779 break;
+ − 780 }
+ − 781 case 'k': /* Key sequence (vector of events) */
+ − 782 {
+ − 783 struct gcpro ngcpro1;
+ − 784 Lisp_Object tem;
+ − 785 Lisp_Object key_prompt = PROMPT ();
+ − 786
+ − 787 NGCPRO1(key_prompt);
+ − 788 tem = Fread_key_sequence (key_prompt, Qnil, Qnil);
+ − 789 NUNGCPRO;
+ − 790
+ − 791 visargs[argnum] = Fkey_description (tem);
+ − 792 /* The following makes `describe-key' not work with
+ − 793 extent-local keymaps and such; and anyway, it's
+ − 794 contrary to the documentation. */
+ − 795 /* args[argnum] = call1 (Qevents_to_keys, tem); */
+ − 796 args[argnum] = tem;
+ − 797 arg_from_tty = 1;
+ − 798 break;
+ − 799 }
+ − 800 case 'K': /* Key sequence (vector of events),
+ − 801 no automatic downcasing */
+ − 802 {
+ − 803 struct gcpro ngcpro1;
+ − 804 Lisp_Object tem;
+ − 805 Lisp_Object key_prompt = PROMPT ();
+ − 806
+ − 807 NGCPRO1(key_prompt);
+ − 808 tem = Fread_key_sequence (key_prompt, Qnil, Qt);
+ − 809 NUNGCPRO;
+ − 810
+ − 811 visargs[argnum] = Fkey_description (tem);
+ − 812 /* The following makes `describe-key' not work with
+ − 813 extent-local keymaps and such; and anyway, it's
+ − 814 contrary to the documentation. */
+ − 815 /* args[argnum] = call1 (Qevents_to_keys, tem); */
+ − 816 args[argnum] = tem;
+ − 817 arg_from_tty = 1;
+ − 818 break;
+ − 819 }
+ − 820
+ − 821 case 'm': /* Value of mark. Does not do I/O. */
+ − 822 {
+ − 823 args[argnum] = current_buffer->mark;
+ − 824 varies[argnum] = Qmark;
+ − 825 break;
+ − 826 }
+ − 827 case 'n': /* Read number from minibuffer. */
+ − 828 {
+ − 829 read_number:
+ − 830 args[argnum] = call2 (Qread_number, PROMPT (), Qnil);
+ − 831 /* numbers are too boring to go on command history */
+ − 832 /* arg_from_tty = 1; */
+ − 833 break;
+ − 834 }
+ − 835 case 'N': /* Prefix arg, else number from minibuffer */
+ − 836 {
+ − 837 if (NILP (prefix))
+ − 838 goto read_number;
+ − 839 else
+ − 840 goto prefix_value;
+ − 841 }
+ − 842 case 'P': /* Prefix arg in raw form. Does no I/O. */
+ − 843 {
+ − 844 args[argnum] = prefix;
+ − 845 break;
+ − 846 }
+ − 847 case 'p': /* Prefix arg converted to number. No I/O. */
+ − 848 {
+ − 849 prefix_value:
+ − 850 {
+ − 851 Lisp_Object tem = Fprefix_numeric_value (prefix);
+ − 852 args[argnum] = tem;
+ − 853 }
+ − 854 break;
+ − 855 }
+ − 856 case 'r': /* Region, point and mark as 2 args. */
+ − 857 {
665
+ − 858 Charbpos tem = check_mark ();
428
+ − 859 args[argnum] = (BUF_PT (current_buffer) < tem
+ − 860 ? Fcopy_marker (current_buffer->point_marker, Qt)
+ − 861 : current_buffer->mark);
+ − 862 varies[argnum] = Qregion_beginning;
+ − 863 args[++argnum] = (BUF_PT (current_buffer) > tem
+ − 864 ? Fcopy_marker (current_buffer->point_marker,
+ − 865 Qt)
+ − 866 : current_buffer->mark);
+ − 867 varies[argnum] = Qregion_end;
+ − 868 break;
+ − 869 }
+ − 870 case 's': /* String read via minibuffer. */
+ − 871 {
+ − 872 args[argnum] = call1 (Qread_string, PROMPT ());
+ − 873 arg_from_tty = 1;
+ − 874 break;
+ − 875 }
+ − 876 case 'S': /* Any symbol. */
+ − 877 {
+ − 878 visargs[argnum] = Qnil;
+ − 879 for (;;)
+ − 880 {
+ − 881 Lisp_Object tem = call5 (Qcompleting_read,
+ − 882 PROMPT (),
+ − 883 Vobarray,
+ − 884 Qnil,
+ − 885 Qnil,
+ − 886 /* nil, or prev attempt */
+ − 887 visargs[argnum]);
+ − 888 visargs[argnum] = tem;
+ − 889 /* I could use condition-case with this loser, but why bother?
+ − 890 * tem = Fread (tem); check-symbol-p;
+ − 891 */
+ − 892 tem = Fintern (tem, Qnil);
+ − 893 args[argnum] = tem;
793
+ − 894 if (XSTRING_LENGTH (XSYMBOL (tem)->name) > 0)
428
+ − 895 /* Don't accept the empty-named symbol. If the loser
+ − 896 really wants this s/he can call completing-read
+ − 897 directly */
+ − 898 break;
+ − 899 }
+ − 900 arg_from_tty = 1;
+ − 901 break;
+ − 902 }
+ − 903 case 'v': /* Variable name: user-variable-p symbol */
+ − 904 {
+ − 905 Lisp_Object tem = call1 (Qread_variable, PROMPT ());
+ − 906 args[argnum] = tem;
+ − 907 arg_from_tty = 1;
+ − 908 break;
+ − 909 }
+ − 910 case 'x': /* Lisp expression read but not evaluated */
+ − 911 {
+ − 912 args[argnum] = call1 (Qread_expression, PROMPT ());
+ − 913 /* visargs[argnum] = Fprin1_to_string (args[argnum], Qnil); */
+ − 914 arg_from_tty = 1;
+ − 915 break;
+ − 916 }
+ − 917 case 'X': /* Lisp expression read and evaluated */
+ − 918 {
+ − 919 Lisp_Object tem = call1 (Qread_expression, PROMPT ());
+ − 920 /* visargs[argnum] = Fprin1_to_string (tem, Qnil); */
+ − 921 args[argnum] = Feval (tem);
+ − 922 arg_from_tty = 1;
+ − 923 break;
+ − 924 }
+ − 925 case 'Z': /* Coding-system symbol or nil if no prefix */
+ − 926 {
+ − 927 if (NILP (prefix))
+ − 928 {
+ − 929 args[argnum] = Qnil;
+ − 930 }
+ − 931 else
+ − 932 {
+ − 933 args[argnum] =
+ − 934 call1 (Qread_non_nil_coding_system, PROMPT ());
+ − 935 arg_from_tty = 1;
+ − 936 }
+ − 937 break;
+ − 938 }
+ − 939 case 'z': /* Coding-system symbol */
+ − 940 {
+ − 941 args[argnum] = call1 (Qread_coding_system, PROMPT ());
+ − 942 arg_from_tty = 1;
+ − 943 break;
+ − 944 }
+ − 945
+ − 946 /* We have a case for `+' so we get an error
+ − 947 if anyone tries to define one here. */
+ − 948 case '+':
+ − 949 default:
+ − 950 {
826
+ − 951 signal_ferror
+ − 952 (Qsyntax_error,
+ − 953 "Invalid `interactive' control letter \"%c\" (#o%03o).",
+ − 954 prompt_data[prompt_index], prompt_data[prompt_index]);
428
+ − 955 }
+ − 956 }
+ − 957 #undef PROMPT
+ − 958 if (NILP (visargs[argnum]))
+ − 959 visargs[argnum] = args[argnum];
+ − 960
+ − 961 if (!prompt_limit)
+ − 962 break;
+ − 963 if (STRINGP (specs))
442
+ − 964 prompt_data = (const char *) XSTRING_DATA (specs);
428
+ − 965 prompt_index += prompt_length + 1 + 1; /* +1 to skip spec, +1 for \n */
+ − 966 }
771
+ − 967 unbind_to (speccount);
428
+ − 968
+ − 969 QUIT;
+ − 970
+ − 971 if (EQ (record_flag, Qlambda))
+ − 972 {
+ − 973 RETURN_UNGCPRO (Flist (argcount, args));
+ − 974 }
+ − 975
+ − 976 if (arg_from_tty || !NILP (record_flag))
+ − 977 {
+ − 978 /* Reuse visargs as a temporary for constructing the command history */
+ − 979 for (argnum = 0; argnum < argcount; argnum++)
+ − 980 {
+ − 981 if (!NILP (varies[argnum]))
+ − 982 visargs[argnum] = list1 (varies[argnum]);
+ − 983 else
+ − 984 visargs[argnum] = Fquote_maybe (args[argnum]);
+ − 985 }
+ − 986 Vcommand_history = Fcons (Fcons (args[-1], Flist (argcount, visargs)),
+ − 987 Vcommand_history);
+ − 988 }
+ − 989
+ − 990 /* If we used a marker to hold point, mark, or an end of the region,
+ − 991 temporarily, convert it to an integer now. */
+ − 992 for (argnum = 0; argnum < argcount; argnum++)
+ − 993 if (!NILP (varies[argnum]))
793
+ − 994 args[argnum] = make_int (marker_position (args[argnum]));
428
+ − 995
+ − 996 single_console_state ();
+ − 997 specbind (Qcommand_debug_status, Qnil);
+ − 998 fun = Ffuncall (argcount + 1, args - 1);
+ − 999 UNGCPRO;
+ − 1000 if (set_zmacs_region_stays)
+ − 1001 zmacs_region_stays = 1;
771
+ − 1002 return unbind_to_1 (speccount, fun);
428
+ − 1003 }
+ − 1004 }
+ − 1005
+ − 1006 DEFUN ("prefix-numeric-value", Fprefix_numeric_value, 1, 1, 0, /*
444
+ − 1007 Return numeric meaning of raw prefix argument RAW.
428
+ − 1008 A raw prefix argument is what you get from `(interactive "P")'.
+ − 1009 Its numeric meaning is what you would get from `(interactive "p")'.
+ − 1010 */
+ − 1011 (raw))
+ − 1012 {
+ − 1013 if (NILP (raw))
+ − 1014 return make_int (1);
+ − 1015 if (EQ (raw, Qminus))
+ − 1016 return make_int (-1);
+ − 1017 if (INTP (raw))
+ − 1018 return raw;
+ − 1019 if (CONSP (raw) && INTP (XCAR (raw)))
+ − 1020 return XCAR (raw);
+ − 1021
+ − 1022 return make_int (1);
+ − 1023 }
+ − 1024
+ − 1025 void
+ − 1026 syms_of_callint (void)
+ − 1027 {
563
+ − 1028 DEFSYMBOL (Qcall_interactively);
+ − 1029 DEFSYMBOL (Qread_from_minibuffer);
+ − 1030 DEFSYMBOL (Qcompleting_read);
+ − 1031 DEFSYMBOL (Qread_file_name);
+ − 1032 DEFSYMBOL (Qread_directory_name);
+ − 1033 DEFSYMBOL (Qread_string);
+ − 1034 DEFSYMBOL (Qread_buffer);
+ − 1035 DEFSYMBOL (Qread_variable);
+ − 1036 DEFSYMBOL (Qread_function);
+ − 1037 DEFSYMBOL (Qread_command);
+ − 1038 DEFSYMBOL (Qread_number);
+ − 1039 DEFSYMBOL (Qread_expression);
+ − 1040 DEFSYMBOL (Qread_coding_system);
+ − 1041 DEFSYMBOL (Qread_non_nil_coding_system);
+ − 1042 DEFSYMBOL (Qevents_to_keys);
+ − 1043 DEFSYMBOL (Qcommand_debug_status);
+ − 1044 DEFSYMBOL (Qenable_recursive_minibuffers);
428
+ − 1045
+ − 1046 defsymbol (&QletX, "let*");
563
+ − 1047 DEFSYMBOL (Qsave_excursion);
428
+ − 1048 #if 0 /* ill-conceived */
563
+ − 1049 DEFSYMBOL (Qmouse_leave_buffer_hook);
428
+ − 1050 #endif
+ − 1051
+ − 1052 DEFSUBR (Finteractive);
+ − 1053 DEFSUBR (Fquote_maybe);
+ − 1054 DEFSUBR (Fcall_interactively);
+ − 1055 DEFSUBR (Fprefix_numeric_value);
+ − 1056 }
+ − 1057
+ − 1058 void
+ − 1059 vars_of_callint (void)
+ − 1060 {
+ − 1061 DEFVAR_LISP ("current-prefix-arg", &Vcurrent_prefix_arg /*
+ − 1062 The value of the prefix argument for this editing command.
+ − 1063 It may be a number, or the symbol `-' for just a minus sign as arg,
+ − 1064 or a list whose car is a number for just one or more C-U's
+ − 1065 or nil if no argument has been specified.
+ − 1066 This is what `(interactive "P")' returns.
+ − 1067 */ );
+ − 1068 Vcurrent_prefix_arg = Qnil;
+ − 1069
+ − 1070 DEFVAR_LISP ("command-history", &Vcommand_history /*
+ − 1071 List of recent commands that read arguments from terminal.
+ − 1072 Each command is represented as a form to evaluate.
+ − 1073 */ );
+ − 1074 Vcommand_history = Qnil;
+ − 1075
+ − 1076 DEFVAR_LISP ("command-debug-status", &Vcommand_debug_status /*
+ − 1077 Debugging status of current interactive command.
+ − 1078 Bound each time `call-interactively' is called;
+ − 1079 may be set by the debugger as a reminder for itself.
+ − 1080 */ );
+ − 1081 Vcommand_debug_status = Qnil;
+ − 1082
+ − 1083 #if 0 /* FSFmacs */
+ − 1084 xxDEFVAR_LISP ("mark-even-if-inactive", &Vmark_even_if_inactive /*
+ − 1085 *Non-nil means you can use the mark even when inactive.
+ − 1086 This option makes a difference in Transient Mark mode.
+ − 1087 When the option is non-nil, deactivation of the mark
+ − 1088 turns off region highlighting, but commands that use the mark
+ − 1089 behave as if the mark were still active.
+ − 1090 */ );
+ − 1091 Vmark_even_if_inactive = Qnil;
+ − 1092 #endif
+ − 1093
+ − 1094 #if 0 /* Doesn't work and is totally ill-conceived anyway. */
+ − 1095 xxDEFVAR_LISP ("mouse-leave-buffer-hook", &Vmouse_leave_buffer_hook /*
+ − 1096 Hook to run when about to switch windows with a mouse command.
+ − 1097 Its purpose is to give temporary modes such as Isearch mode
+ − 1098 a way to turn themselves off when a mouse command switches windows.
+ − 1099 */ );
+ − 1100 Vmouse_leave_buffer_hook = Qnil;
+ − 1101 #endif
+ − 1102 }