]> code.delx.au - gnu-emacs/blobdiff - src/callint.c
Update copyright year to 2016
[gnu-emacs] / src / callint.c
index 43566acfbe9b35aa1fac2a9667e5737095ebc4d3..3b23f2229862d5eddba4c25bb8f1ac8fe592f62a 100644 (file)
@@ -1,5 +1,5 @@
 /* Call a Lisp function interactively.
-   Copyright (C) 1985-1986, 1993-1995, 1997, 2000-2015 Free Software
+   Copyright (C) 1985-1986, 1993-1995, 1997, 2000-2016 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -23,10 +23,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #include "character.h"
 #include "buffer.h"
-#include "commands.h"
 #include "keyboard.h"
 #include "window.h"
-#include "keymap.h"
 
 static Lisp_Object preserved_fns;
 
@@ -228,18 +226,9 @@ static Lisp_Object
 read_file_name (Lisp_Object default_filename, Lisp_Object mustmatch,
                Lisp_Object initial, Lisp_Object predicate)
 {
-  struct gcpro gcpro1;
-  Lisp_Object args[7];
-
-  GCPRO1 (default_filename);
-  args[0] = intern ("read-file-name");
-  args[1] = callint_message;
-  args[2] = Qnil;
-  args[3] = default_filename;
-  args[4] = mustmatch;
-  args[5] = initial;
-  args[6] = predicate;
-  RETURN_UNGCPRO (Ffuncall (7, args));
+  return CALLN (Ffuncall, intern ("read-file-name"),
+               callint_message, Qnil, default_filename,
+               mustmatch, initial, predicate);
 }
 
 /* BEWARE: Calling this directly from C would defeat the purpose!  */
@@ -305,7 +294,6 @@ invoke it.  If KEYS is omitted or nil, the return value of
   ptrdiff_t i, nargs;
   ptrdiff_t mark;
   bool arg_from_tty = 0;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   ptrdiff_t key_count;
   bool record_then_fail = 0;
 
@@ -347,9 +335,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
   /* Set SPECS to the interactive form, or barf if not interactive.  */
   {
     Lisp_Object form;
-    GCPRO2 (function, prefix_arg);
     form = Finteractive_form (function);
-    UNGCPRO;
     if (CONSP (form))
       specs = filter_specs = Fcar (XCDR (form));
     else
@@ -364,11 +350,9 @@ invoke it.  If KEYS is omitted or nil, the return value of
       uintmax_t events = num_input_events;
       input = specs;
       /* Compute the arg values using the user's expression.  */
-      GCPRO2 (input, filter_specs);
       specs = Feval (specs,
                     CONSP (funval) && EQ (Qclosure, XCAR (funval))
                     ? CAR_SAFE (XCDR (funval)) : Qnil);
-      UNGCPRO;
       if (events != num_input_events || !NILP (record_flag))
        {
          /* We should record this command on the command history.  */
@@ -397,15 +381,11 @@ invoke it.  If KEYS is omitted or nil, the return value of
       Vreal_this_command = save_real_this_command;
       kset_last_command (current_kboard, save_last_command);
 
-      {
-       Lisp_Object args[3];
-       args[0] = Qfuncall_interactively;
-       args[1] = function;
-       args[2] = specs;
-       Lisp_Object result = unbind_to (speccount, Fapply (3, args));
-       SAFE_FREE ();
-       return result;
-      }
+      Lisp_Object result
+       = unbind_to (speccount, CALLN (Fapply, Qfuncall_interactively,
+                                      function, specs));
+      SAFE_FREE ();
+      return result;
     }
 
   /* SPECS is set to a string; use it as an interactive prompt.
@@ -509,13 +489,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
   visargs = args + nargs;
   varies = (signed char *) (visargs + nargs);
 
-  memset (args, 0, nargs * (2 * word_size + 1));
-  if (NIL_IS_NONZERO)
-    memsetnil (args, nargs * 2);
-
-  GCPRO5 (prefix_arg, function, *args, *visargs, up_event);
-  gcpro3.nvars = nargs;
-  gcpro4.nvars = nargs;
+  memclear (args, nargs * (2 * word_size + 1));
 
   if (!NILP (enable))
     specbind (Qenable_recursive_minibuffers, Qt);
@@ -525,7 +499,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
     {
       visargs[1] = make_string (tem + 1, strcspn (tem + 1, "\n"));
       if (strchr (SSDATA (visargs[1]), '%'))
-       callint_message = Fformat (i - 1, visargs + 1);
+       callint_message = Fformat_message (i - 1, visargs + 1);
       else
        callint_message = visargs[1];
 
@@ -544,13 +518,13 @@ invoke it.  If KEYS is omitted or nil, the return value of
          args[i] = Fcurrent_buffer ();
          if (EQ (selected_window, minibuf_window))
            args[i] = Fother_buffer (args[i], Qnil, Qnil);
-         args[i] = Fread_buffer (callint_message, args[i], Qt);
+         args[i] = Fread_buffer (callint_message, args[i], Qt, Qnil);
          break;
 
        case 'B':               /* Name of buffer, possibly nonexistent.  */
          args[i] = Fread_buffer (callint_message,
                                  Fother_buffer (Fcurrent_buffer (), Qnil, Qnil),
-                                 Qnil);
+                                 Qnil, Qnil);
          break;
 
         case 'c':              /* Character.  */
@@ -628,9 +602,9 @@ invoke it.  If KEYS is omitted or nil, the return value of
              {
                Lisp_Object tem2;
 
-               teml = Fget (teml, intern ("event-symbol-elements"));
+               teml = Fget (teml, Qevent_symbol_elements);
                /* Ignore first element, which is the base key.  */
-               tem2 = Fmemq (intern ("down"), Fcdr (teml));
+               tem2 = Fmemq (Qdown, Fcdr (teml));
                if (! NILP (tem2))
                  up_event = Fread_event (Qnil, Qnil, Qnil);
              }
@@ -660,9 +634,9 @@ invoke it.  If KEYS is omitted or nil, the return value of
              {
                Lisp_Object tem2;
 
-               teml = Fget (teml, intern ("event-symbol-elements"));
+               teml = Fget (teml, Qevent_symbol_elements);
                /* Ignore first element, which is the base key.  */
-               tem2 = Fmemq (intern ("down"), Fcdr (teml));
+               tem2 = Fmemq (Qdown, Fcdr (teml));
                if (! NILP (tem2))
                  up_event = Fread_event (Qnil, Qnil, Qnil);
              }
@@ -860,7 +834,6 @@ invoke it.  If KEYS is omitted or nil, the return value of
 
   {
     Lisp_Object val = Ffuncall (nargs, args);
-    UNGCPRO;
     val = unbind_to (speccount, val);
     SAFE_FREE ();
     return val;
@@ -917,7 +890,6 @@ syms_of_callint (void)
   DEFSYM (Qhandle_shift_selection, "handle-shift-selection");
   DEFSYM (Qread_number, "read-number");
   DEFSYM (Qfuncall_interactively, "funcall-interactively");
-  DEFSYM (Qcommand_debug_status, "command-debug-status");
   DEFSYM (Qenable_recursive_minibuffers, "enable-recursive-minibuffers");
   DEFSYM (Qmouse_leave_buffer_hook, "mouse-leave-buffer-hook");