branch: elpa/magit commit bb11a56df421607bb52e54af6dd6801e03e4cdaf Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
magit-{diff,log}{,-refresh}: Pick up all buffer arguments When the value of a diff or log menu was being initialized from the arguments in the current buffer and the diff/log was already limited to a set of files, then all other arguments were discarded. The value of the prefix's `value' slot is a flat list of arguments and in that list the "--" argument is represented as a list beginning with "--", followed by the files. This is different from `magit-{diff,log}-arguments', which returns (ARGS FILES), which is probably how this bug came to be (but note that the order is also different and that FILES is just a list of files, without a "--" at its head. Closes #5304. --- CHANGELOG | 4 ++++ lisp/magit-diff.el | 4 ++-- lisp/magit-log.el | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3526ff73e2..e4a3a3e5e8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -84,6 +84,10 @@ Bug fixes: exists in Emacs since 29.1, so this will only help users stuck on Emacs 28. #5300 +- When the value of a diff or log menu was being initialized from the + arguments in the current buffer and the diff/log was already limited + to a set of files, then all other arguments were discarded. #5304 + * v4.2.0 2025-01-01 - At least Git 2.25.0 is required now. 033a0c0cdc diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el index a573c7f6c4..cd1dd9c19b 100644 --- a/lisp/magit-diff.el +++ b/lisp/magit-diff.el @@ -817,12 +817,12 @@ and `:slant'." (when-let (((not (eq transient-current-command 'magit-dispatch))) (file (magit-file-relative-name))) (setq files (list file))) - (oset obj value (if files `(("--" ,@files) ,args) args)))) + (oset obj value (if files `(("--" ,@files) ,@args) args)))) (cl-defmethod transient-init-value ((obj magit-diff-refresh-prefix)) (oset obj value (if magit-buffer-diff-files `(("--" ,@magit-buffer-diff-files) - ,magit-buffer-diff-args) + ,@magit-buffer-diff-args) magit-buffer-diff-args))) (cl-defmethod transient-set-value ((obj magit-diff-prefix)) diff --git a/lisp/magit-log.el b/lisp/magit-log.el index 1113697ef4..37a4f04c9e 100644 --- a/lisp/magit-log.el +++ b/lisp/magit-log.el @@ -376,12 +376,12 @@ commits before and half after." (when-let (((not (eq transient-current-command 'magit-dispatch))) (file (magit-file-relative-name))) (setq files (list file))) - (oset obj value (if files `(("--" ,@files) ,args) args)))) + (oset obj value (if files `(("--" ,@files) ,@args) args)))) (cl-defmethod transient-init-value ((obj magit-log-refresh-prefix)) (oset obj value (if magit-buffer-log-files `(("--" ,@magit-buffer-log-files) - ,magit-buffer-log-args) + ,@magit-buffer-log-args) magit-buffer-log-args))) (cl-defmethod transient-set-value ((obj magit-log-prefix))