]> git.eshelyaron.com Git - emacs.git/commitdiff
; * src/callint.c (Fcall_interactively): Refine docstring.
authorEshel Yaron <me@eshelyaron.com>
Mon, 12 May 2025 19:50:07 +0000 (21:50 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 12 May 2025 19:50:07 +0000 (21:50 +0200)
lisp/bookmark.el
src/callint.c

index 2cc04b8b228dc315240fda821597355f8adaad10..f9c93e04cf53961019c2d2ee67e1ffcdf7bbaad6 100644 (file)
@@ -2219,18 +2219,17 @@ You can mark bookmarks with the \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-mar
       nil)))
 
 
-(defun bookmark-bmenu-save ()
+(defun bookmark-bmenu-save (&optional promptp defaultp)
   "Save the current list into a bookmark file.
 With a prefix arg, prompt for a file to save them in.
 
 See also the related behaviors of `bookmark-load' and
 `bookmark-bmenu-load'."
-  (interactive nil bookmark-bmenu-mode)
-  (save-excursion
-    (save-window-excursion
-      (call-interactively 'bookmark-save)
-      (set-buffer-modified-p nil))))
-
+  (interactive
+   (list current-prefix-arg (equal '(16) current-prefix-arg))
+   bookmark-bmenu-mode)
+  (bookmark-save promptp nil defaultp)
+  (set-buffer-modified-p nil))
 
 (defun bookmark-bmenu-load ()
   "Load bookmarks from a file and rebuild the bookmark menu-buffer.
index 7979d8b2ef0d34f0b72e3091f1c663aeff11470e..a068effd3449800370b90d9f6b9395af2523ac3b 100644 (file)
@@ -251,23 +251,27 @@ usage: (funcall-interactively FUNCTION &rest ARGUMENTS)  */)
 }
 
 DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 3, 0,
-       doc: /* Call FUNCTION, providing args according to its interactive calling specs.
-Return the value FUNCTION returns.
-The function contains a specification of how to do the argument reading.
-In the case of user-defined functions, this is specified by placing a call
-to the function `interactive' at the top level of the function body.
-See `interactive'.
+       doc: /* Call COMMAND, as if the user invoked it interactively.
 
-Optional second arg RECORD-FLAG non-nil
-means unconditionally put this command in the variable `command-history'.
-Otherwise, this is done only if an arg is read using the minibuffer.
+Provide arguments to COMMAND according to its interactive calling
+specs, and return the value COMMAND returns.
+
+Prefer calling COMMAND directly instead of using this function if
+possible, such as when COMMAND is a constant function name and its
+interactive calling spec is not too complex.
+
+Optional second arg RECORD-FLAG non-nil means unconditionally put this
+command in the variable `command-history'.  Otherwise, this is done only
+if an arg is read using the minibuffer.
 
 Optional third arg KEYS, if given, specifies the sequence of events to
-supply, as a vector, if FUNCTION inquires which events were used to
+supply, as a vector, if COMMAND inquires which events were used to
 invoke it (via an `interactive' spec that contains, for instance, an
 \"e\" code letter).  If KEYS is omitted or nil, the return value of
-`this-command-keys-vector' is used.  */)
-  (Lisp_Object function, Lisp_Object record_flag, Lisp_Object keys)
+`this-command-keys-vector' is used.
+
+See also `interactive'.  */)
+  (Lisp_Object command, Lisp_Object record_flag, Lisp_Object keys)
 {
   specpdl_ref speccount = SPECPDL_INDEX ();
 
@@ -296,9 +300,9 @@ invoke it (via an `interactive' spec that contains, for instance, an
   Lisp_Object up_event = Qnil;
 
   /* Set SPECS to the interactive form, or barf if not interactive.  */
-  Lisp_Object form = calln (Qinteractive_form, function);
+  Lisp_Object form = calln (Qinteractive_form, command);
   if (! CONSP (form))
-    wrong_type_argument (Qcommandp, function);
+    wrong_type_argument (Qcommandp, command);
   Lisp_Object specs = Fcar (XCDR (form));
 
   /* At this point the value of SPECS could help provide a way to
@@ -308,7 +312,7 @@ invoke it (via an `interactive' spec that contains, for instance, an
   /* If SPECS is not a string, invent one.  */
   if (! STRINGP (specs))
     {
-      Lisp_Object funval = Findirect_function (function, Qt);
+      Lisp_Object funval = Findirect_function (command, Qt);
       uintmax_t events = num_input_events;
       Lisp_Object env = CLOSUREP (funval) && CONSP (AREF (funval, CLOSURE_CODE))
                        ? AREF (funval, CLOSURE_CONSTANTS) : Qnil;
@@ -320,9 +324,9 @@ invoke it (via an `interactive' spec that contains, for instance, an
             Make a copy of the list of values, for the command history,
             and turn them into things we can eval.  */
          Lisp_Object values = quotify_args (Fcopy_sequence (specs));
-         fix_command (function, values);
+         fix_command (command, values);
           calln (Qadd_to_history, Qcommand_history,
-                 Fcons (function, values), Qnil, Qt);
+                 Fcons (command, values), Qnil, Qt);
        }
 
       Vthis_command = save_this_command;
@@ -331,7 +335,7 @@ invoke it (via an `interactive' spec that contains, for instance, an
       kset_last_command (current_kboard, save_last_command);
 
       return unbind_to (speccount, CALLN (Fapply, Qfuncall_interactively,
-                                         function, specs));
+                                         command, specs));
     }
 
   /* SPECS is set to a string; use it as an interactive prompt.
@@ -590,8 +594,8 @@ invoke it (via an `interactive' spec that contains, for instance, an
        case 'e':               /* The invoking event.  */
          if (next_event >= key_count)
            error ("%s must be bound to an event with parameters",
-                  (SYMBOLP (function)
-                   ? SSDATA (SYMBOL_NAME (function))
+                  (SYMBOLP (command)
+                   ? SSDATA (SYMBOL_NAME (command))
                    : "command"));
          args[i] = AREF (keys, next_event);
          varies[i] = -1;
@@ -743,13 +747,13 @@ invoke it (via an `interactive' spec that contains, for instance, an
   maybe_quit ();
 
   args[0] = Qfuncall_interactively;
-  args[1] = function;
+  args[1] = command;
 
   if (arg_from_tty || !NILP (record_flag))
     {
       /* We don't need `visargs' any more, so let's recycle it since we need
         an array of just the same size.  */
-      visargs[1] = function;
+      visargs[1] = command;
       for (ptrdiff_t i = 2; i < nargs; i++)
        visargs[i] = (varies[i] > 0
                      ? list1 (intern (callint_argfuns[varies[i]]))