Compare commits

..

No commits in common. "f8ae2a62252f2bd2630dc4e2c18ed11f5a50c1b7" and "2b920ae743b0df2c0d5d0bffa22a901bf6f6ba3d" have entirely different histories.

37
init.el
View File

@ -425,8 +425,8 @@ If the current window occupies the whole frame, split it."
;; (eldoc 'nothing) ;; (eldoc 'nothing)
;; load evil or meow ;; load evil or meow
(require 'mir-evil) ;; (require 'mir-evil)
;; (require 'mir-meow) (require 'mir-meow)
(use-package undo-fu (use-package undo-fu
;; :after evil ;; :after evil
@ -1089,12 +1089,41 @@ Return nil if DIR is not in a hugo project at all."
(use-package transient :ensure t) (use-package transient :ensure t)
(use-package magit (use-package magit
:after seq :after seq
:commands (magit-status magit) :commands (madots magit-status magit)
:hook (magit-mode . turn-off-line-numbers) :hook (magit-mode . turn-off-line-numbers)
:custom (vc-follow-symlinks t) :custom (vc-follow-symlinks t)
(transient-history-file (transient-history-file
(expand-file-name "transient/history.el" backup-directory)) (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 ;; ;; broken bc of hl-todo version issue
;; (use-package magit-todos ;; (use-package magit-todos
;; :after magit ;; :after magit