aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d
diff options
context:
space:
mode:
authorRaul Benencia <id@rbenencia.name>2026-03-06 09:06:20 -0800
committerRaul Benencia <id@rbenencia.name>2026-03-06 09:06:20 -0800
commit9d7e37f02284600593d255a8e9c62bb701fccef1 (patch)
treee369b8611b3cd688bcc5868a8943f9178a741b95 /.emacs.d
parent4c3d5d383d4ca9154694f0edb4104938a467f42e (diff)
emacs: git-commit-setup for magit
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/rul-lisp/packages/rul-vc.el38
1 files changed, 25 insertions, 13 deletions
diff --git a/.emacs.d/rul-lisp/packages/rul-vc.el b/.emacs.d/rul-lisp/packages/rul-vc.el
index a602b0d..8551647 100644
--- a/.emacs.d/rul-lisp/packages/rul-vc.el
+++ b/.emacs.d/rul-lisp/packages/rul-vc.el
@@ -1,21 +1,33 @@
+;;; rul-vc.el --- Version control configuration -*- lexical-binding: t; -*-
+
(setq vc-follow-symlinks nil)
(use-package magit
:ensure t
- :bind
- (("C-c g s" . magit-status)
- ("C-c g F" . magit-pull-from-upstream)
- ("C-c g b" . magit-blame))
+ :bind (("C-c g s" . magit-status)
+ ("C-c g F" . magit-pull-from-upstream)
+ ("C-c g b" . magit-blame))
+ :hook (git-commit-setup . rul/git-commit-setup)
:config
- (progn
- (defun inkel/magit-log-edit-mode-hook ()
- (flyspell-mode t)
- (turn-on-auto-fill))
- (defadvice magit-status (around magit-fullscreen activate)
- (window-configuration-to-register :magit-fullscreen)
- ad-do-it
- (delete-other-windows))))
+ (defun rul/git-commit-setup ()
+ "Enable useful text modes for Git commit buffers."
+ (flyspell-mode 1)
+ (auto-fill-mode 1))
+
+ (defun rul/magit-status-save-window-config (&rest _)
+ "Save current window configuration before invoking `magit-status'."
+ (window-configuration-to-register :magit-fullscreen))
+
+ (defun rul/magit-status-single-window (&rest _)
+ "Display `magit-status' in a single window."
+ (delete-other-windows))
+
+ (advice-add 'magit-status :before #'rul/magit-status-save-window-config)
+ (advice-add 'magit-status :after #'rul/magit-status-single-window))
-(add-to-list 'project-switch-commands '(magit-project-status "Magit" "m"))
+(with-eval-after-load 'project
+ (add-to-list 'project-switch-commands
+ '(magit-project-status "Magit" "m")))
(provide 'rul-vc)
+;;; rul-vc.el ends here
nihil fit ex nihilo