Allow specifying how args are to be stored in `command-history'

* doc/lispref/functions.texi (Declare Form): Document
`interactive-args'
* lisp/replace.el (replace-string): Store the correct interactive
arguments (bug#45607).

* lisp/emacs-lisp/byte-run.el (byte-run--set-interactive-args):
New function.
(defun-declarations-alist): Use it.

* src/callint.c (fix_command): Remove the old hack (which now
longer works since interactive specs are byte-compiled) and
instead rely on `interactive-args'.
This commit is contained in:
Lars Ingebrigtsen 2022-08-08 15:52:19 +02:00
parent 498c5d26bb
commit ffc81ebc4b
5 changed files with 73 additions and 79 deletions

View file

@ -236,6 +236,20 @@ The return value of this function is not used."
(list 'function-put (list 'quote f)
''command-modes (list 'quote val))))
(defalias 'byte-run--set-interactive-args
#'(lambda (f args &rest val)
(setq args (remove '&optional (remove '&rest args)))
(list 'function-put (list 'quote f)
''interactive-args
(list
'quote
(mapcar
(lambda (elem)
(cons
(seq-position args (car elem))
(cadr elem)))
val)))))
;; Add any new entries to info node `(elisp)Declare Form'.
(defvar defun-declarations-alist
(list
@ -255,7 +269,8 @@ If `error-free', drop calls even if `byte-compile-delete-errors' is nil.")
(list 'indent #'byte-run--set-indent)
(list 'speed #'byte-run--set-speed)
(list 'completion #'byte-run--set-completion)
(list 'modes #'byte-run--set-modes))
(list 'modes #'byte-run--set-modes)
(list 'interactive-args #'byte-run--set-interactive-args))
"List associating function properties to their macro expansion.
Each element of the list takes the form (PROP FUN) where FUN is
a function. For each (PROP . VALUES) in a function's declaration,