Add function madots
to use magit for dotfiles. Hacky but mostly works.
This commit is contained in:
parent
2aefe688ad
commit
d5dadb6ad1
@ -784,8 +784,30 @@ See https://emacs.stackexchange.com/questions/2538/how-to-define-additional-mode
|
||||
(corfu-terminal-mode +1)))
|
||||
|
||||
(use-package magit
|
||||
:commands magit
|
||||
:hook (magit-mode . turn-off-line-numbers))
|
||||
:commands (madots magit-status magit)
|
||||
:hook (magit-mode . turn-off-line-numbers)
|
||||
:config
|
||||
(defun madots--magit-buffers-p ()
|
||||
(not (not ; converts all non-nil values to t
|
||||
(remove nil ; clean useless elements
|
||||
(mapcar (lambda (buffer)
|
||||
(if (string-match-p "magit: " (buffer-name buffer))
|
||||
buffer))
|
||||
(buffer-list))))))
|
||||
(defun madots--cleanup ()
|
||||
"Remove modifications made for `madots' once all magit buffers are killed."
|
||||
(if (not (madots--magit-buffers-p))
|
||||
(progn
|
||||
(setq magit-git-executable madots--old-magit-exe)
|
||||
(cancel-function-timers #'madots--cleanup))))
|
||||
(defun madots (&optional exe)
|
||||
"Magit but with custom EXE, default \"dots\"."
|
||||
(interactive)
|
||||
(require 'magit)
|
||||
(setq madots--old-magit-exe magit-git-executable)
|
||||
(setq magit-git-executable (or exe "dots"))
|
||||
(magit-status)
|
||||
(run-with-timer 5 3 #'madots--cleanup)))
|
||||
|
||||
(use-package hyperbole
|
||||
;; :straight (:type built-in) ;; doesn't work
|
||||
|
Loading…
Reference in New Issue
Block a user