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-07 16:52:35 +0100
committerDavid Morgan <djm_uk@protonmail.com>2021-07-07 16:52:35 +0100
commit64ca29b76b7f265ab2d5f5a88452118da40aa4c8 (patch)
treefaf2f048f7b5406a186044255734439f4f336cbb /emacs-prelude/personal/lisp/init-git.el
parent3fbaf487183e7b7e3785628ab8ed6290ddd94fd7 (diff)
downloaddotfiles-64ca29b76b7f265ab2d5f5a88452118da40aa4c8.tar.gz
Update emacs prelude config (vertico, corfu, consult, etc)
Diffstat (limited to 'emacs-prelude/personal/lisp/init-git.el')
-rw-r--r--emacs-prelude/personal/lisp/init-git.el22
1 files changed, 16 insertions, 6 deletions
diff --git a/emacs-prelude/personal/lisp/init-git.el b/emacs-prelude/personal/lisp/init-git.el
index 5cb0b78..7bc19f1 100644
--- a/emacs-prelude/personal/lisp/init-git.el
+++ b/emacs-prelude/personal/lisp/init-git.el
@@ -1,13 +1,23 @@
-(defun magit-set-upstream ()
-  (interactive)
-  (magit-shell-command-topdir "git upstream"))
-
 (use-package magit
   :after key-chord
+  :init
+  (defun my/magit-set-upstream ()
+    (interactive)
+    (magit-shell-command-topdir "git upstream"))
   :config
-  (key-chord-define-global "UU" 'magit-set-upstream))
-;  :bind (("C-c g y" . magit-upstream))) ;; TODO
+  (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)))))))
 
+(prelude-require-package 'forge)
 (use-package forge
   :after magit)