;;; git.el --- magit and stuff. -*- lexical-binding: t; -*- ;; Time-stamp: <2020-03-18T14:57:49+0100> ;;; Commentary: ;;; Code: (require 'basics/package-management) (require 'basics/global-variables) ;; Git integration. (use-package git-commit :defer 5 ;; :pin melpa ) (unless slow-computer (use-package magit ;; :pin melpa :custom (magit-diff-refine-hunk 'all) ; Show word-granularity differences. :config ;; (defun my/magit-display-buffer (buffer) "Workaround to ensure that BUFFER is split vertically if necessary." (if (and git-commit-mode (with-current-buffer buffer (derived-mode-p 'magit-diff-mode))) (purpose--action-function buffer '((display-buffer-pop-up-window display-buffer-use-some-window display-buffer-below-selected) (inhibit-same-window . t)))) (magit-display-buffer-traditional buffer)) (setq magit-display-buffer-function #'my/magit-display-buffer) :bind ("C-x g" . magit-status) ("C-x M-g" . magit-dispatch) :hook (after-save . magit-after-save-refresh-status) ) ;; Use libgit rather than git. (use-package magit-libgit ;; :pin melpa ) ;; Show TODOs in magit-status. (use-package magit-todos :after magit :config ;; Mark variables as safe. This prevents prompts when using .dir-locals.el. (put 'magit-todos-depth 'safe-local-variable #'integerp) :hook (magit-mode . magit-todos-mode) ) ;; Work with Git forges from Magit. (use-package forge ;; :pin melpa ; :after magit :config (add-to-list 'forge-alist '("schlomp.space" "schlomp.space/api/v1" "schlomp.space" forge-gitea-repository)) ) ) ; unless slow-computer. (provide 'programming/git) ;;; git.el ends here