tools/magit: replace magithub with forge #1174
And we're back to using the latest version of magit, which should
resolve void-function and void-variable errors that we were avioding in
33ef9034
.
This commit is contained in:
parent
b8da259d90
commit
ffcfde71d9
2 changed files with 26 additions and 59 deletions
|
@ -1,34 +1,27 @@
|
|||
;;; tools/magit/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +magit-hub-enable-by-default nil
|
||||
"Whether or not to enable magithub features for all projects by default. Must
|
||||
be set before `magithub' (and `magit') is loaded.")
|
||||
|
||||
(defvar +magit-hub-features t
|
||||
"What features to initialize when `magithub' is loaded. Set this to `t' to
|
||||
load everything, and nil to load nothing. See `magithub-feature-list' to see
|
||||
what features are available.")
|
||||
|
||||
|
||||
;;
|
||||
;; Packages
|
||||
|
||||
(def-package! magit
|
||||
:commands magit-file-delete
|
||||
:defer-incrementally (dash f s with-editor git-commit package)
|
||||
:defer-incrementally (dash f s with-editor git-commit package eieio lv transient)
|
||||
:init
|
||||
(setq magit-auto-revert-mode nil) ; we already use `global-auto-revert-mode'
|
||||
:config
|
||||
(setq magit-revision-show-gravatars '("^Author: " . "^Commit: ")
|
||||
magit-diff-refine-hunk t ; show word-granularity on selected hunk
|
||||
magit-display-buffer-function #'+magit-display-buffer
|
||||
(setq transient-default-level 5
|
||||
transient-levels-file (concat doom-etc-dir "transient/levels")
|
||||
transient-values-file (concat doom-etc-dir "transient/values")
|
||||
transient-history-file (concat doom-etc-dir "transient/history")
|
||||
magit-revision-show-gravatars '("^Author: " . "^Commit: ")
|
||||
magit-diff-refine-hunk t) ; show granular diffs in selected hunk
|
||||
|
||||
;; Leave it to `+magit-display-buffer' and `+magit-display-popup-buffer' to
|
||||
;; manage popup windows.
|
||||
(setq magit-display-buffer-function #'+magit-display-buffer
|
||||
magit-popup-display-buffer-action '((+magit-display-popup-buffer)))
|
||||
|
||||
(set-popup-rule! "^\\(?:\\*magit\\|magit:\\)" :ignore t)
|
||||
|
||||
(magit-define-popup-option 'magit-rebase-popup
|
||||
?S "Sign using gpg" "--gpg-sign=" #'magit-read-gpg-secret-key)
|
||||
|
||||
;; so magit buffers can be switched to (except for process buffers)
|
||||
(defun +magit-buffer-p (buf)
|
||||
(with-current-buffer buf
|
||||
|
@ -44,6 +37,19 @@ what features are available.")
|
|||
(define-key magit-status-mode-map [remap magit-mode-bury-buffer] #'+magit/quit))
|
||||
|
||||
|
||||
(def-package! forge
|
||||
;; we defer loading even further because forge's dependencies will try to
|
||||
;; compile emacsql, which is a slow and blocking operation.
|
||||
:after-call magit-status
|
||||
:init
|
||||
(setq forge-database-file (concat doom-etc-dir "forge/forge-database.sqlite"))
|
||||
:config
|
||||
;; All forge list modes are derived from `forge-topic-list-mode'
|
||||
(map! :map forge-topic-list-mode-map :n "q" #'kill-this-buffer)
|
||||
(set-popup-rule! "^\\*?[0-9]+:\\(?:new-\\|[0-9]+$\\)" :size 0.45 :modeline t :ttl 0 :quit nil)
|
||||
(set-popup-rule! "^\\*\\(?:[^/]+/[^ ]+ #[0-9]+\\*$\\|Issues\\|Pull-Requests\\|forge\\)" :ignore t))
|
||||
|
||||
|
||||
(def-package! magit-todos
|
||||
:after magit
|
||||
:config
|
||||
|
@ -53,29 +59,6 @@ what features are available.")
|
|||
(magit-todos-mode +1))
|
||||
|
||||
|
||||
(def-package! magithub
|
||||
:after magit
|
||||
:unless (featurep! :tools magit +forge)
|
||||
:preface
|
||||
;; Magithub is not well-behaved, so this needs to be set early
|
||||
(setq magithub-dir (concat doom-etc-dir "magithub/"))
|
||||
:init
|
||||
(setq magithub-clone-default-directory "~/"
|
||||
magithub-preferred-remote-method 'clone_url)
|
||||
:config
|
||||
(unless +magit-hub-enable-by-default
|
||||
;; Disable magit by default. Can be enabled through magithub settings popup,
|
||||
;; or setting `+magit-hub-enable-by-default'.
|
||||
(advice-add #'magithub-enabled-p :override #'+magit*hub-enabled-p)
|
||||
;; I don't use `magithub-settings--simple' to redefine this because it
|
||||
;; changes the order of settings. Obnoxious, but the alternative is even
|
||||
;; more so.
|
||||
(advice-add #'magithub-settings--format-magithub.enabled
|
||||
:override #'+magit*hub-settings--format-magithub.enabled))
|
||||
(when +magit-hub-features
|
||||
(magithub-feature-autoinject +magit-hub-features)))
|
||||
|
||||
|
||||
(def-package! magit-gitflow
|
||||
:hook (magit-mode . turn-on-magit-gitflow))
|
||||
|
||||
|
@ -98,10 +81,3 @@ what features are available.")
|
|||
(evil-define-key* evil-magit-state git-rebase-mode-map
|
||||
"gj" #'git-rebase-move-line-down
|
||||
"gk" #'git-rebase-move-line-up)))
|
||||
|
||||
|
||||
(def-package! forge
|
||||
:when (featurep! :tools magit +forge)
|
||||
:after magit
|
||||
:init
|
||||
(setq forge-database-file (concat doom-etc-dir "forge/forge-database.sqlite")))
|
||||
|
|
|
@ -1,18 +1,9 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; tools/magit/packages.el
|
||||
|
||||
;; Magit introduced some breaking changes in a recent commit that breaks
|
||||
;; evil-magit and magithub.
|
||||
;; TODO Once those packages have updated, we'll go back to tracking magit HEAD
|
||||
(when (package! magit :recipe
|
||||
(:fetcher github
|
||||
:repo "magit/magit"
|
||||
:commit "78114e6425d5e7d6eaa7712c845f28694aa7faeb"
|
||||
:files ("lisp/magit" "lisp/magit*.el" "lisp/git-rebase.el")))
|
||||
(when (package! magit)
|
||||
(package! forge)
|
||||
(package! magit-gitflow)
|
||||
(if (featurep! +forge)
|
||||
(package! forge)
|
||||
(package! magithub))
|
||||
(package! magit-todos)
|
||||
(when (featurep! :feature evil +everywhere)
|
||||
(package! evil-magit)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue