diff options
author | Franck Cuny <franck@fcuny.net> | 2021-01-06 15:17:34 -0800 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2021-01-06 15:17:34 -0800 |
commit | 9dae34d548074492563644d71c6418efa827ff0a (patch) | |
tree | 70221b511f2a4aae91468b193631627411f688ea /emacs/custom | |
parent | README: get a list of installed packages on linux (diff) | |
download | emacs.d-9dae34d548074492563644d71c6418efa827ff0a.tar.gz |
emacs: performance improvement for magit
When working with 'source', magit is extremely slow (source is a huge repository, so it's not surprising). We can improve significantly performances by disabling a number of hooks when running git status.
Diffstat (limited to 'emacs/custom')
-rw-r--r-- | emacs/custom/fcuny-git.el | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/emacs/custom/fcuny-git.el b/emacs/custom/fcuny-git.el index e3b8c45..a6a3829 100644 --- a/emacs/custom/fcuny-git.el +++ b/emacs/custom/fcuny-git.el @@ -14,7 +14,48 @@ :after (flyspell) :bind (("C-x g" . magit-status)) :custom - (vc-follow-symlinks t)) + (vc-follow-symlinks t) + :config + ;; if we're on darwin, we're on a work laptop, so let's make sure we + ;; use the proper `git' binary. + (when (string= system-type "darwin") + (setq magit-git-executable "/opt/twitter_mde/bin/git")) + ;; I want to see these things by default + (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 'magit-section-initial-visibility-alist '(stashes . show)) + ;; no need to show the last 10 commits, 5 is enough. + (setq magit-log-section-commit-count 5) + ;; when working with source, some of the hooks are extremely + ;; expensive and don't add much values (i.e tags). Let's reduce the + ;; list to things that are actually useful. This still takes ~10 + ;; seconds when running `magit-status'. + (setq git-commit-setup-hook + '(git-commit-save-message + git-commit-turn-on-auto-fill + git-commit-turn-on-flyspell + git-commit-propertize-diff + with-editor-usage-message)) + (setq magit-refs-sections-hook + '(magit-insert-error-header + magit-insert-branch-description + magit-insert-local-branches)) + (setq magit-status-sections-hook + '(magit-insert-status-headers + magit-insert-merge-log + magit-insert-rebase-sequence + magit-insert-am-sequence + magit-insert-sequencer-sequence + magit-insert-untracked-files + magit-insert-unstaged-changes + magit-insert-staged-changes + magit-insert-stashes)) + (setq magit-status-headers-hook + '(magit-insert-error-header + magit-insert-diff-filter-header + magit-insert-head-branch-header))) (use-package git-commit :ensure t |