From 6584352f9cb348193a9a217398776138c91212a3 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Sun, 30 Jul 2023 11:12:56 +0200 Subject: Add command to toggle between author/commit dates --- .emacs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.emacs b/.emacs index 6d7ba70..b044ac8 100644 --- a/.emacs +++ b/.emacs @@ -226,6 +226,20 @@ (require 'project) (magit-status (project-prompt-project-dir))) +(defun my/magit-toggle-margin-date () + (interactive) + (let ((do-message + (lambda (old new) + (message + "%s ⇒ %s" + (propertize old 'face 'shadow) + (propertize new 'face 'bold))))) + (apply do-message (if magit-log-margin-show-committer-date + '("commit" "author") '("author" "commit"))) + (setq magit-log-margin-show-committer-date + (not magit-log-margin-show-committer-date)) + (revert-buffer))) + (defmacro my/define-prefix-command (name doc bindings) (declare (indent defun)) `(defvar ,name @@ -255,10 +269,11 @@ (my/define-prefix-command my/magit-map "Keymap for Magit commands." - '(("f" magit-file-dispatch) - ("\C-f" magit-find-file) + '(("d" my/magit-toggle-margin-date) + ("f" magit-file-dispatch) ("g" magit-status) - ("x" magit-dispatch))) + ("x" magit-dispatch) + ("\C-f" magit-find-file))) (my/define-prefix-command my/input-map "Keymap for input methods shortcuts." -- cgit v1.2.3