branch: elpa/magit commit 35c0805458ee9b9a4c57c87e0b97f1673a52a80e Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
magit-dired-log: If no files are marked, show log for directory That way we can use it instead of `magit-log-buffer-file' in `magit-file-dispatch', without losing the ability to quickly show the log for the visited directory. --- lisp/magit-dired.el | 5 +++-- lisp/magit-files.el | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/magit-dired.el b/lisp/magit-dired.el index e5deb95d42..5e361ac9f3 100644 --- a/lisp/magit-dired.el +++ b/lisp/magit-dired.el @@ -61,11 +61,12 @@ is no file at point, then instead visit `default-directory'." ;;;###autoload (defun magit-dired-log (&optional follow) - "In Dired, show log for all marked files or the file at point." + "In Dired, show log for all marked files or the directory if none are marked." (interactive "P") (if-let ((topdir (magit-toplevel default-directory))) (let ((args (car (magit-log-arguments))) - (files (dired-get-marked-files))) + (files (or (dired-get-marked-files nil 'marked) + (list default-directory)))) (when (and follow (not (member "--follow" args)) (not (cdr files))) diff --git a/lisp/magit-files.el b/lisp/magit-files.el index a0088ea58c..038b49882d 100644 --- a/lisp/magit-files.el +++ b/lisp/magit-files.el @@ -313,7 +313,8 @@ to `magit-dispatch'." ("d" "Diff" magit-diff-buffer-file)] ["" ("L" "Log..." magit-log) - ("l" "Log" magit-log-buffer-file) + ("l" "Log" magit-log-buffer-file :if-not-derived dired-mode) + ("l" "Log" magit-dired-log :if-derived dired-mode) ("t" "Trace" magit-log-trace-definition) (7 "M" "Merged" magit-log-merged)] [""