diff options
| author | Richard M. Stallman | 1992-10-30 06:01:13 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1992-10-30 06:01:13 +0000 |
| commit | 03e130d5cad91052f51c1a43e58a72924b3d18bc (patch) | |
| tree | c6ede3f8523881ebd167437a063496bdd4952ba3 /src | |
| parent | e47b25708bd1da0788727bd662ed813d1f422638 (diff) | |
| download | emacs-03e130d5cad91052f51c1a43e58a72924b3d18bc.tar.gz emacs-03e130d5cad91052f51c1a43e58a72924b3d18bc.zip | |
(preserved_fns): New var.
(Fcall_interactively): Preserve fns listed in preserved_fns
when they appear in an interactive spec which is a call to `list'.
(syms_of_callint): Set preserved_fns and staticpro it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/callint.c | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/src/callint.c b/src/callint.c index c3375818ba8..9f0a98c24bd 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -35,6 +35,9 @@ Lisp_Object Vcommand_history; | |||
| 35 | Lisp_Object Vcommand_debug_status, Qcommand_debug_status; | 35 | Lisp_Object Vcommand_debug_status, Qcommand_debug_status; |
| 36 | Lisp_Object Qenable_recursive_minibuffers; | 36 | Lisp_Object Qenable_recursive_minibuffers; |
| 37 | 37 | ||
| 38 | Lisp_Object Qlist; | ||
| 39 | Lisp_Object preserved_fns; | ||
| 40 | |||
| 38 | /* This comment supplies the doc string for interactive, | 41 | /* This comment supplies the doc string for interactive, |
| 39 | for make-docfile to see. We cannot put this in the real DEFUN | 42 | for make-docfile to see. We cannot put this in the real DEFUN |
| 40 | due to limits in the Unix cpp. | 43 | due to limits in the Unix cpp. |
| @@ -250,12 +253,44 @@ Otherwise, this is done only if an arg is read using the minibuffer.") | |||
| 250 | } | 253 | } |
| 251 | else if (string == 0) | 254 | else if (string == 0) |
| 252 | { | 255 | { |
| 256 | Lisp_Object input; | ||
| 253 | i = num_input_chars; | 257 | i = num_input_chars; |
| 258 | input = specs; | ||
| 259 | /* Compute the arg values using the user's expression. */ | ||
| 254 | specs = Feval (specs); | 260 | specs = Feval (specs); |
| 255 | if (i != num_input_chars || !NILP (record)) | 261 | if (i != num_input_chars || !NILP (record)) |
| 256 | Vcommand_history | 262 | { |
| 257 | = Fcons (Fcons (function, quotify_args (Fcopy_sequence (specs))), | 263 | /* We should record this command on the command history. */ |
| 258 | Vcommand_history); | 264 | Lisp_Object values, car; |
| 265 | /* Make a copy of the list of values, for the command history, | ||
| 266 | and turn them into things we can eval. */ | ||
| 267 | values = quotify_args (Fcopy_sequence (specs)); | ||
| 268 | /* If the list of args was produced with an explicit call to `list', | ||
| 269 | look for elements that were computed with (region-beginning) | ||
| 270 | or (region-end), and put those expressions into VALUES | ||
| 271 | instead of the present values. */ | ||
| 272 | car = Fcar (input); | ||
| 273 | if (EQ (car, Qlist)) | ||
| 274 | { | ||
| 275 | Lisp_Object intail, valtail; | ||
| 276 | for (intail = Fcdr (input), valtail = values; | ||
| 277 | CONSP (valtail); | ||
| 278 | intail = Fcdr (intail), valtail = Fcdr (valtail)) | ||
| 279 | { | ||
| 280 | Lisp_Object elt; | ||
| 281 | elt = Fcar (intail); | ||
| 282 | if (CONSP (elt)) | ||
| 283 | { | ||
| 284 | Lisp_Object presflag; | ||
| 285 | presflag = Fmemq (Fcar (elt), preserved_fns); | ||
| 286 | if (!NILP (presflag)) | ||
| 287 | Fsetcar (valtail, Fcar (intail)); | ||
| 288 | } | ||
| 289 | } | ||
| 290 | } | ||
| 291 | Vcommand_history | ||
| 292 | = Fcons (Fcons (function, values), Vcommand_history); | ||
| 293 | } | ||
| 259 | return apply1 (function, specs); | 294 | return apply1 (function, specs); |
| 260 | } | 295 | } |
| 261 | 296 | ||
| @@ -553,6 +588,15 @@ Its numeric meaning is what you would get from `(interactive \"p\")'.") | |||
| 553 | 588 | ||
| 554 | syms_of_callint () | 589 | syms_of_callint () |
| 555 | { | 590 | { |
| 591 | preserved_fns = Fcons (intern ("region-beginning"), | ||
| 592 | Fcons (intern ("region-end"), | ||
| 593 | Fcons (intern ("point"), | ||
| 594 | Fcons (intern ("mark"), Qnil)))); | ||
| 595 | staticpro (&preserved_fns); | ||
| 596 | |||
| 597 | Qlist = intern ("list"); | ||
| 598 | staticpro (&Qlist); | ||
| 599 | |||
| 556 | Qminus = intern ("-"); | 600 | Qminus = intern ("-"); |
| 557 | staticpro (&Qminus); | 601 | staticpro (&Qminus); |
| 558 | 602 | ||