mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-03-01 11:20:41 -08:00
(fix_command): New subroutine, from Fcall_interactively.
Detect (when ... (region-beginning)) etc. (Fcall_interactively): Call fix_command. (Qif, Qwhen): New variables. (syms_of_callint): Init and staticpro them.
This commit is contained in:
parent
e3bfcda9ac
commit
120d0a23ea
2 changed files with 80 additions and 39 deletions
|
|
@ -1,3 +1,13 @@
|
|||
2003-02-23 Richard M. Stallman <rms@gnu.org>
|
||||
|
||||
* callint.c (fix_command): New subroutine, from Fcall_interactively.
|
||||
Detect (when ... (region-beginning)) etc.
|
||||
(Fcall_interactively): Call fix_command.
|
||||
(Qif, Qwhen): New variables.
|
||||
(syms_of_callint): Init and staticpro them.
|
||||
|
||||
* regex.c (print_partial_compiled_pattern): Output to stderr.
|
||||
|
||||
2003-02-23 Kai Gro,A_(Bjohann <kai.grossjohann@uni-duisburg.de>
|
||||
|
||||
* dired.c (directory_files_internal): Don't expand directory.
|
||||
|
|
|
|||
109
src/callint.c
109
src/callint.c
|
|
@ -51,7 +51,7 @@ Lisp_Object Vmark_even_if_inactive;
|
|||
|
||||
Lisp_Object Vmouse_leave_buffer_hook, Qmouse_leave_buffer_hook;
|
||||
|
||||
Lisp_Object Qlist, Qlet, Qletx, Qsave_excursion, Qprogn;
|
||||
Lisp_Object Qlist, Qlet, Qletx, Qsave_excursion, Qprogn, Qif, Qwhen;
|
||||
static Lisp_Object preserved_fns;
|
||||
|
||||
/* Marker used within call-interactively to refer to point. */
|
||||
|
|
@ -315,44 +315,7 @@ supply if the command inquires which events were used to invoke it. */)
|
|||
/* 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));
|
||||
/* If the list of args was produced with an explicit call to `list',
|
||||
look for elements that were computed with (region-beginning)
|
||||
or (region-end), and put those expressions into VALUES
|
||||
instead of the present values. */
|
||||
if (CONSP (input))
|
||||
{
|
||||
car = XCAR (input);
|
||||
/* Skip through certain special forms. */
|
||||
while (EQ (car, Qlet) || EQ (car, Qletx)
|
||||
|| EQ (car, Qsave_excursion)
|
||||
|| EQ (car, Qprogn))
|
||||
{
|
||||
while (CONSP (XCDR (input)))
|
||||
input = XCDR (input);
|
||||
input = XCAR (input);
|
||||
if (!CONSP (input))
|
||||
break;
|
||||
car = XCAR (input);
|
||||
}
|
||||
if (EQ (car, Qlist))
|
||||
{
|
||||
Lisp_Object intail, valtail;
|
||||
for (intail = Fcdr (input), valtail = values;
|
||||
CONSP (valtail);
|
||||
intail = Fcdr (intail), valtail = Fcdr (valtail))
|
||||
{
|
||||
Lisp_Object elt;
|
||||
elt = Fcar (intail);
|
||||
if (CONSP (elt))
|
||||
{
|
||||
Lisp_Object presflag;
|
||||
presflag = Fmemq (Fcar (elt), preserved_fns);
|
||||
if (!NILP (presflag))
|
||||
Fsetcar (valtail, Fcar (intail));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fix_command (input, values);
|
||||
Vcommand_history
|
||||
= Fcons (Fcons (function, values), Vcommand_history);
|
||||
|
||||
|
|
@ -822,6 +785,70 @@ supply if the command inquires which events were used to invoke it. */)
|
|||
}
|
||||
}
|
||||
|
||||
Lisp_Object
|
||||
fix_command (input, values)
|
||||
Lisp_Object input, values;
|
||||
{
|
||||
/* If the list of args was produced with an explicit call to `list',
|
||||
look for elements that were computed with (region-beginning)
|
||||
or (region-end), and put those expressions into VALUES
|
||||
instead of the present values. */
|
||||
if (CONSP (input))
|
||||
{
|
||||
Lisp_Object car;
|
||||
|
||||
car = XCAR (input);
|
||||
/* Skip through certain special forms. */
|
||||
while (EQ (car, Qlet) || EQ (car, Qletx)
|
||||
|| EQ (car, Qsave_excursion)
|
||||
|| EQ (car, Qprogn))
|
||||
{
|
||||
while (CONSP (XCDR (input)))
|
||||
input = XCDR (input);
|
||||
input = XCAR (input);
|
||||
if (!CONSP (input))
|
||||
break;
|
||||
car = XCAR (input);
|
||||
}
|
||||
if (EQ (car, Qlist))
|
||||
{
|
||||
Lisp_Object intail, valtail;
|
||||
for (intail = Fcdr (input), valtail = values;
|
||||
CONSP (valtail);
|
||||
intail = Fcdr (intail), valtail = Fcdr (valtail))
|
||||
{
|
||||
Lisp_Object elt;
|
||||
elt = Fcar (intail);
|
||||
if (CONSP (elt))
|
||||
{
|
||||
Lisp_Object presflag, carelt;
|
||||
carelt = Fcar (elt);
|
||||
/* If it is (if X Y), look at Y. */
|
||||
if (EQ (carelt, Qif)
|
||||
&& EQ (Fnthcdr (make_number (3), elt), Qnil))
|
||||
elt = Fnth (make_number (2), elt);
|
||||
/* If it is (when ... Y), look at Y. */
|
||||
else if (EQ (carelt, Qwhen))
|
||||
{
|
||||
while (CONSP (XCDR (elt)))
|
||||
elt = XCDR (elt);
|
||||
elt = Fcar (elt);
|
||||
}
|
||||
|
||||
/* If the function call we're looking at
|
||||
is a special preserved one, copy the
|
||||
whole expression for this argument. */
|
||||
if (CONSP (elt))
|
||||
{
|
||||
presflag = Fmemq (Fcar (elt), preserved_fns);
|
||||
if (!NILP (presflag))
|
||||
Fsetcar (valtail, Fcar (intail));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DEFUN ("prefix-numeric-value", Fprefix_numeric_value, Sprefix_numeric_value,
|
||||
1, 1, 0,
|
||||
doc: /* Return numeric meaning of raw prefix argument RAW.
|
||||
|
|
@ -862,6 +889,10 @@ syms_of_callint ()
|
|||
staticpro (&Qlist);
|
||||
Qlet = intern ("let");
|
||||
staticpro (&Qlet);
|
||||
Qif = intern ("if");
|
||||
staticpro (&Qif);
|
||||
Qwhen = intern ("when");
|
||||
staticpro (&Qwhen);
|
||||
Qletx = intern ("let*");
|
||||
staticpro (&Qletx);
|
||||
Qsave_excursion = intern ("save-excursion");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue