Compare commits

..

2 Commits

37
init.el
View File

@ -425,8 +425,8 @@ If the current window occupies the whole frame, split it."
;; (eldoc 'nothing)
;; load evil or meow
;; (require 'mir-evil)
(require 'mir-meow)
(require 'mir-evil)
;; (require 'mir-meow)
(use-package undo-fu
;; :after evil
@ -1089,41 +1089,12 @@ Return nil if DIR is not in a hugo project at all."
(use-package transient :ensure t)
(use-package magit
:after seq
:commands (madots magit-status magit)
:commands (magit-status magit)
:hook (magit-mode . turn-off-line-numbers)
:custom (vc-follow-symlinks t)
(transient-history-file
(expand-file-name "transient/history.el" backup-directory))
: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--kill-all-magit-buffers ()
(mapcar (lambda (buffer)
(if (string-match-p "^magit" (buffer-name buffer))
(kill-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)
(setq magit-bury-buffer-function madots--old-magit-bury-buf-func)
(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"))
(setq madots--old-magit-bury-buf-func magit-bury-buffer-function)
(setq magit-bury-buffer-function #'kill-buffer-and-window)
(magit-status)
(run-with-timer 5 3 #'madots--cleanup)))
)
;; ;; broken bc of hl-todo version issue
;; (use-package magit-todos
;; :after magit