summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-10-24 17:21:06 -0700
committerFranck Cuny <franck@fcuny.net>2022-10-24 17:21:06 -0700
commitbb6d79a4917b098422d42266ab19c469abac0334 (patch)
treea0c1943d020e48b686758ae04c2e925a50e1d7ab
parentfix(packages): remove tempel (diff)
downloademacs.d-bb6d79a4917b098422d42266ab19c469abac0334.tar.gz
ref(git): organize the module in settings, bindings and hooks
Add a few more settings for magit, to expand some of the sections, and
to open the buffer for status in a full frame.

Change-Id: Ic3e158b21b03416b4549acd338cc985195a4901a
-rw-r--r--emacs/custom/my-git.el32
1 files changed, 25 insertions, 7 deletions
diff --git a/emacs/custom/my-git.el b/emacs/custom/my-git.el
index 7a3a345..2270f91 100644
--- a/emacs/custom/my-git.el
+++ b/emacs/custom/my-git.el
@@ -4,6 +4,27 @@
 
 ;;; Code:
 
+(require 'magit)
+(require 'git-link)
+
+;;; settings
+(setq vc-follow-symlinks t)
+
+;; we're not barbarians
+(setq git-commit-summary-max-length 70)
+
+;; open the link in the browser
+(setq git-link-open-in-browser 't)
+
+;; I prefer to have the status buffer in full frame
+(setq magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1)
+
+;; expand a number of sections with magit
+(add-to-list 'magit-section-initial-visibility-alist '(untracked . show))
+(add-to-list 'magit-section-initial-visibility-alist '(unstaged  . show))
+(add-to-list 'magit-section-initial-visibility-alist '(unpulled  . show))
+(add-to-list 'magit-section-initial-visibility-alist '(unpushed  . show))
+
 (add-to-list 'auto-mode-alist '("\\.gitconfig\\'"     . gitconfig-mode))
 (add-to-list 'auto-mode-alist '("\\.git/config\\'"    . gitconfig-mode))
 (add-to-list 'auto-mode-alist '("\\.gitmodules\\'"    . gitconfig-mode))
@@ -11,9 +32,12 @@
 (add-to-list 'auto-mode-alist '("\\.dockerignore\\'"  . gitconfig-mode))
 (add-to-list 'auto-mode-alist '("\\.gitattributes\\'" . gitattributes-mode))
 
-(setq vc-follow-symlinks t)
+;;; bindings
 (global-set-key (kbd "C-x g") 'magit-status)
+(global-set-key (kbd "C-c g l") 'git-link)
+(global-set-key (kbd "C-c g c") 'git-link-commit)
 
+;;; hooks
 (defun my/git-commit-auto-fill ()
   "Ensures that the commit body does not exceed 72 characters."
   (setq-local fill-column 72)
@@ -21,12 +45,6 @@
 
 (add-hook 'git-commit-mode-hook 'my/git-commit-auto-fill)
 
-(customize-set-variable 'git-commit-summary-max-length 70)
-
-(global-set-key (kbd "C-c g l") 'git-link)
-(global-set-key (kbd "C-c g c") 'git-link-commit)
-(customize-set-variable 'git-link-open-in-browser 't)
-
 (provide 'my-git)
 
 ;;; my-git.el ends here