/[emacs]/emacs/src/callint.c
ViewVC logotype

Diff of /emacs/src/callint.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.122 by lektu, Tue Feb 4 14:03:11 2003 UTC revision 1.123 by rms, Sun Feb 23 15:13:41 2003 UTC
# Line 51  Lisp_Object Vmark_even_if_inactive; Line 51  Lisp_Object Vmark_even_if_inactive;
51    
52  Lisp_Object Vmouse_leave_buffer_hook, Qmouse_leave_buffer_hook;  Lisp_Object Vmouse_leave_buffer_hook, Qmouse_leave_buffer_hook;
53    
54  Lisp_Object Qlist, Qlet, Qletx, Qsave_excursion, Qprogn;  Lisp_Object Qlist, Qlet, Qletx, Qsave_excursion, Qprogn, Qif, Qwhen;
55  static Lisp_Object preserved_fns;  static Lisp_Object preserved_fns;
56    
57  /* Marker used within call-interactively to refer to point.  */  /* Marker used within call-interactively to refer to point.  */
# Line 315  supply if the command inquires which eve Line 315  supply if the command inquires which eve
315            /* Make a copy of the list of values, for the command history,            /* Make a copy of the list of values, for the command history,
316               and turn them into things we can eval.  */               and turn them into things we can eval.  */
317            values = quotify_args (Fcopy_sequence (specs));            values = quotify_args (Fcopy_sequence (specs));
318            /* If the list of args was produced with an explicit call to `list',            fix_command (input, values);
              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));  
                         }  
                     }  
                 }  
             }  
319            Vcommand_history            Vcommand_history
320              = Fcons (Fcons (function, values), Vcommand_history);              = Fcons (Fcons (function, values), Vcommand_history);
321    
# Line 822  supply if the command inquires which eve Line 785  supply if the command inquires which eve
785    }    }
786  }  }
787    
788    Lisp_Object
789    fix_command (input, values)
790         Lisp_Object input, values;
791    {
792      /* If the list of args was produced with an explicit call to `list',
793         look for elements that were computed with (region-beginning)
794         or (region-end), and put those expressions into VALUES
795         instead of the present values.  */
796      if (CONSP (input))
797        {
798          Lisp_Object car;
799    
800          car = XCAR (input);
801          /* Skip through certain special forms.  */
802          while (EQ (car, Qlet) || EQ (car, Qletx)
803                 || EQ (car, Qsave_excursion)
804                 || EQ (car, Qprogn))
805            {
806              while (CONSP (XCDR (input)))
807                input = XCDR (input);
808              input = XCAR (input);
809              if (!CONSP (input))
810                break;
811              car = XCAR (input);
812            }
813          if (EQ (car, Qlist))
814            {
815              Lisp_Object intail, valtail;
816              for (intail = Fcdr (input), valtail = values;
817                   CONSP (valtail);
818                   intail = Fcdr (intail), valtail = Fcdr (valtail))
819                {
820                  Lisp_Object elt;
821                  elt = Fcar (intail);
822                  if (CONSP (elt))
823                    {
824                      Lisp_Object presflag, carelt;
825                      carelt = Fcar (elt);
826                      /* If it is (if X Y), look at Y.  */
827                      if (EQ (carelt, Qif)
828                          && EQ (Fnthcdr (make_number (3), elt), Qnil))
829                        elt = Fnth (make_number (2), elt);
830                      /* If it is (when ... Y), look at Y.  */
831                      else if (EQ (carelt, Qwhen))
832                        {
833                          while (CONSP (XCDR (elt)))
834                            elt = XCDR (elt);
835                          elt = Fcar (elt);
836                        }
837    
838                      /* If the function call we're looking at
839                         is a special preserved one, copy the
840                         whole expression for this argument.  */
841                      if (CONSP (elt))
842                        {
843                          presflag = Fmemq (Fcar (elt), preserved_fns);
844                          if (!NILP (presflag))
845                            Fsetcar (valtail, Fcar (intail));
846                        }
847                    }
848                }
849            }
850        }
851    }
852  DEFUN ("prefix-numeric-value", Fprefix_numeric_value, Sprefix_numeric_value,  DEFUN ("prefix-numeric-value", Fprefix_numeric_value, Sprefix_numeric_value,
853         1, 1, 0,         1, 1, 0,
854         doc: /* Return numeric meaning of raw prefix argument RAW.         doc: /* Return numeric meaning of raw prefix argument RAW.
# Line 862  syms_of_callint () Line 889  syms_of_callint ()
889    staticpro (&Qlist);    staticpro (&Qlist);
890    Qlet = intern ("let");    Qlet = intern ("let");
891    staticpro (&Qlet);    staticpro (&Qlet);
892      Qif = intern ("if");
893      staticpro (&Qif);
894      Qwhen = intern ("when");
895      staticpro (&Qwhen);
896    Qletx = intern ("let*");    Qletx = intern ("let*");
897    staticpro (&Qletx);    staticpro (&Qletx);
898    Qsave_excursion = intern ("save-excursion");    Qsave_excursion = intern ("save-excursion");

Legend:
Removed from v.1.122  
changed lines
  Added in v.1.123

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26