about summary refs log tree commit diff stats
path: root/emacs-prelude/personal/lisp/init-git.el
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2021-07-09 21:03:07 +0100
committerDavid Morgan <djm_uk@protonmail.com>2021-07-09 21:03:07 +0100
commit02f72d1f9f14ae3c04dc60d99cc5e0c86d064bdf (patch)
treeaa5a09c40b9eb474d1df7cb88f5cbf227c3922ce /emacs-prelude/personal/lisp/init-git.el
parent22525b8d3c7b4f854d2fdf70967d084246729de9 (diff)
downloaddotfiles-02f72d1f9f14ae3c04dc60d99cc5e0c86d064bdf.tar.gz
More updates - consult, git, multi-vterm
Diffstat (limited to 'emacs-prelude/personal/lisp/init-git.el')
-rw-r--r--emacs-prelude/personal/lisp/init-git.el22
1 files changed, 12 insertions, 10 deletions
diff --git a/emacs-prelude/personal/lisp/init-git.el b/emacs-prelude/personal/lisp/init-git.el
index 626b3d0..041ff8e 100644
--- a/emacs-prelude/personal/lisp/init-git.el
+++ b/emacs-prelude/personal/lisp/init-git.el
@@ -4,18 +4,19 @@
   (defun my/magit-set-upstream ()
     (interactive)
     (magit-shell-command-topdir "git upstream"))
+  ;; update stale git info on the modeline (based on code removed from doom modeline)
+  (defun my/magit-refresh-state ()
+    (interactive)
+    (dolist (buf (buffer-list))
+            (when (and (not (buffer-modified-p buf))
+                       (buffer-file-name buf)
+                       (file-exists-p (buffer-file-name buf))
+                       (file-in-directory-p (buffer-file-name buf) (magit-toplevel)))
+              (with-current-buffer buf
+                (vc-refresh-state)))))
   :config
   (key-chord-define-global "UU" 'my/magit-set-upstream)
-  ;; prevent the git info on the modeline from becoming stale (based on code removed from doom modeline)
-  :hook (magit-post-refresh .
-    (lambda ()
-      (dolist (buf (buffer-list))
-        (when (and (not (buffer-modified-p buf))
-                   (buffer-file-name buf)
-                   (file-exists-p (buffer-file-name buf))
-                   (file-in-directory-p (buffer-file-name buf) (magit-toplevel)))
-          (with-current-buffer buf
-            (vc-refresh-state)))))))
+  (key-chord-define-global "RR" 'my/magit-refresh-state))
 
 (prelude-require-package 'forge)
 (use-package forge
@@ -32,3 +33,4 @@
   ("C-c j r" . git-gutter:revert-hunk))
 
 (provide 'init-git)
+