diff --git a/init.el b/init.el index 17d3923..bb137ed 100644 --- a/init.el +++ b/init.el @@ -613,7 +613,6 @@ keyboard-quit-context+ db/convert-lf-to-crlf-in-buffer db/convert-crlf-to-lf-in-buffer - db/sync-magit-repos-from-projectile db/replace-variables-in-string db/dired-ediff-files db/grep-read-files @@ -1519,7 +1518,8 @@ point to the beginning of buffer first." (use-package magit :ensure t :commands (magit-status - magit-list-repositories) + magit-list-repositories + db/sync-magit-repos-from-projectile) :init (progn (setq magit-diff-refine-hunk nil @@ -1527,13 +1527,24 @@ point to the beginning of buffer first." (when on-windows ;; Experimental: on Windows, do not refresh magit-status-buffers - ;; that are not select, to increase performance. + ;; that are not selected, to increase performance. (setq magit-refresh-status-buffer nil))) :config (progn (when (fboundp 'global-magit-file-mode) (global-magit-file-mode -1)) - (global-git-commit-mode +1) + (global-git-commit-mode 1) + + (defun db/sync-magit-repos-from-projectile () + "Update repositories known to magit from projectile's." + (interactive) + (eval-when-compile ; to silence the byte compiler + (require 'projectile)) + (setq magit-repository-directories + (->> projectile-known-projects + (--filter (and (not (file-remote-p it)) + (file-exists-p (concat it "/.git")))) + (--map (cons it 0))))) (db/sync-magit-repos-from-projectile))) diff --git a/site-lisp/db-utils.el b/site-lisp/db-utils.el index ece0ccc..7eaa21d 100644 --- a/site-lisp/db-utils.el +++ b/site-lisp/db-utils.el @@ -448,22 +448,6 @@ Does not replace CRLF with CRCRLF, and so on." (while (re-search-forward "\r\n" nil 'noerror) (replace-match "\n"))))) -(defun db/sync-magit-repos-from-projectile () - "Update repositories known to magit from projectile's." - (interactive) - (eval-when-compile ; to silence the byte compiler - (require 'projectile) - (require 'magit)) - (setq magit-repository-directories - (mapcar - (lambda (dir) - (cons (substring dir 0 -1) 0)) - (cl-remove-if-not - (lambda (project) - (unless (file-remote-p project) - (file-exists-p (concat project "/.git")))) - projectile-known-projects)))) - (defun db/shr-render-file (file) "Display the HTML rending of the contents of FILE." (interactive "f")