From ffc81ebc4b5d6cfc827e6a08679da55134f73fb5 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 8 Aug 2022 15:52:19 +0200 Subject: 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'. --- test/src/callint-tests.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') diff --git a/test/src/callint-tests.el b/test/src/callint-tests.el index d964fc3c1f3..5a633fdc2bd 100644 --- a/test/src/callint-tests.el +++ b/test/src/callint-tests.el @@ -52,4 +52,17 @@ (call-interactively #'ignore t)) (should (= (length command-history) history-length)))) +(defun callint-test-int-args (foo bar &optional zot) + (declare (interactive-args + (bar 10) + (zot 11))) + (interactive (list 1 1 1)) + (+ foo bar zot)) + +(ert-deftest test-interactive-args () + (let ((history-length 1) + (command-history ())) + (should (= (call-interactively 'callint-test-int-args t) 3)) + (should (equal command-history '((callint-test-int-args 1 10 11)))))) + ;;; callint-tests.el ends here -- cgit v1.2.3