Browse Source

Refactor code to update magit's repository list to separate function

This allows easier updates of this list, without having resort to executing the
corresponding code manually.  In the future, we could even update that list
automatically by attaching the new function to some of projectile's hooks or
something.
master
Daniel 11 months ago
parent
commit
e4f02647a2
No known key found for this signature in database GPG Key ID: 1C7071A75BB72D64
  1. 17
      init.el
  2. 15
      site-lisp/db-utils.el

17
init.el

@ -617,7 +617,8 @@
db/switch-to-light-theme
keyboard-quit-context+
db/convert-lf-to-crlf-in-buffer
db/convert-crlf-to-lf-in-buffer))
db/convert-crlf-to-lf-in-buffer
db/sync-magit-repos-from-projectile))
(use-package db-hydras
:commands (hydra-toggle/body
@ -1405,20 +1406,10 @@
magit-commit-show-diff nil)
:config (progn
(when (fboundp 'global-magit-file-mode)
(global-magit-file-mode -1))
(global-magit-file-mode -1))
(global-git-commit-mode +1)
(with-demoted-errors "Non-Fatal Error: %s"
(require 'projectile)
(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))))))
(db/sync-magit-repos-from-projectile)))
(use-package magit-repos
:commands (magit-list-repositories))

15
site-lisp/db-utils.el

@ -424,6 +424,21 @@ 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)
(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))))
;;; Extend Input Methods

Loading…
Cancel
Save