summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKรฉvin Le Gouguec <kevin.legouguec@gmail.com>2023-07-30 11:12:56 +0200
committerKรฉvin Le Gouguec <kevin.legouguec@gmail.com>2023-07-30 11:27:06 +0200
commit6584352f9cb348193a9a217398776138c91212a3 (patch)
tree26f5a2e3733caace68dbbb8e7af74a855e70eb8e
parent9f187474ea27c781f93ed9835167067bc4545540 (diff)
downloaddotfiles-6584352f9cb348193a9a217398776138c91212a3.tar.xz
Add command to toggle between author/commit dates
-rw-r--r--.emacs21
1 files 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."