General refactor & cleanup

+ refactor package management
+ core-editor: describe ediff
+ core-popups: alphabetized hack blocks
+ ui/doom-modeline: refactor buffer path fn
+ feature/version-control/+git: autoload magit-blame
This commit is contained in:
Henrik Lissner 2017-05-14 09:49:09 +02:00
parent af88423b35
commit 25fa4e019c
5 changed files with 21 additions and 21 deletions

View file

@ -11,7 +11,7 @@
(when last-refresh (when last-refresh
(setq doom--last-refresh last-refresh))) (setq doom--last-refresh last-refresh)))
(when (or (not doom--last-refresh) (when (or (not doom--last-refresh)
(> (nth 1 (time-since doom--last-refresh)) 600)) (> (nth 1 (time-since doom--last-refresh)) 900))
(package-refresh-contents) (package-refresh-contents)
(persistent-soft-store (persistent-soft-store
'last-pkg-refresh (setq doom--last-refresh (current-time)) 'last-pkg-refresh (setq doom--last-refresh (current-time))
@ -22,15 +22,17 @@
"Get which backend the package NAME was installed with. Can either be elpa, "Get which backend the package NAME was installed with. Can either be elpa,
quelpa or nil (if not installed)." quelpa or nil (if not installed)."
(doom-initialize) (doom-initialize)
(unless (quelpa-setup-p)
(error "Could not initialize quelpa"))
(cond ((let ((plist (cdr (assq name doom-packages)))) (cond ((let ((plist (cdr (assq name doom-packages))))
(and (not (plist-get plist :pin)) (and (not (plist-get plist :pin))
(or (quelpa-setup-p)
(error "Could not initialize quelpa"))
(or (assq name quelpa-cache) (or (assq name quelpa-cache)
(plist-get plist :recipe)))) (plist-get plist :recipe))))
'quelpa) 'quelpa)
((assq name package-alist) ((assq name package-alist)
'elpa))) 'elpa)
(t
(error "%s package not installed" name))))
;;;###autoload ;;;###autoload
(defun doom-package-outdated-p (name) (defun doom-package-outdated-p (name)
@ -46,7 +48,7 @@ list of the package."
(let ((recipe (assq name quelpa-cache)) (let ((recipe (assq name quelpa-cache))
(dir (expand-file-name (symbol-name name) quelpa-build-dir)) (dir (expand-file-name (symbol-name name) quelpa-build-dir))
(inhibit-message t)) (inhibit-message t))
(if-let (ver (and (quelpa-setup-p) (quelpa-checkout recipe dir))) (if-let (ver (quelpa-checkout recipe dir))
(version-to-list ver) (version-to-list ver)
old-version))) old-version)))
('elpa ('elpa
@ -70,8 +72,6 @@ the packages relevant to that backend.
Warning: this function is expensive; it re-evaluates all of doom's config files. Warning: this function is expensive; it re-evaluates all of doom's config files.
Be careful not to use it in a loop." Be careful not to use it in a loop."
(doom-initialize-packages t) (doom-initialize-packages t)
(unless (quelpa-setup-p)
(error "Could not initialize quelpa"))
(delq nil (delq nil
(mapcar (lambda (pkgsym) (mapcar (lambda (pkgsym)
(or (assq pkgsym doom-packages) (or (assq pkgsym doom-packages)

View file

@ -67,7 +67,7 @@ modes are active and the buffer is read-only.")
recentf-filename-handlers '(abbreviate-file-name)) recentf-filename-handlers '(abbreviate-file-name))
(quiet! (recentf-mode 1)) (quiet! (recentf-mode 1))
;; Ediff ;; Ediff: use existing frame instead of creating a new one
(add-hook! ediff-load (add-hook! ediff-load
(setq ediff-diff-options "-w" (setq ediff-diff-options "-w"
ediff-split-window-function #'split-window-horizontally ediff-split-window-function #'split-window-horizontally

View file

@ -392,6 +392,13 @@ the command buffer."
(doom--switch-from-popup (find-function-search-for-symbol fun 'defface file))))) (doom--switch-from-popup (find-function-search-for-symbol fun 'defface file)))))
(after! mu4e
(defun doom*mu4e-popup-window (buf height)
(doom-popup-buffer buf :size 10 :noselect t)
buf)
(advice-add #'mu4e~temp-window :override #'doom*mu4e-popup-window))
(after! neotree (after! neotree
;; Neotree has its own window/popup management built-in, which is difficult to ;; Neotree has its own window/popup management built-in, which is difficult to
;; police. For example, switching perspectives will cause neotree to forget it ;; police. For example, switching perspectives will cause neotree to forget it
@ -406,22 +413,15 @@ the command buffer."
(doom-popup-buffer buf))) (doom-popup-buffer buf)))
(after! mu4e (after! quickrun
(defun doom*mu4e-popup-window (buf height) ;; don't auto-focus quickrun windows, shackle handles that
(doom-popup-buffer buf :size 10 :noselect t) (setq quickrun-focus-p nil))
buf)
(advice-add #'mu4e~temp-window :override #'doom*mu4e-popup-window))
(after! twittering-mode (after! twittering-mode
(setq twittering-pop-to-buffer-function #'pop-to-buffer)) (setq twittering-pop-to-buffer-function #'pop-to-buffer))
(after! quickrun
;; don't auto-focus quickrun windows, shackle handles that
(setq quickrun-focus-p nil))
(after! xref (after! xref
(defun doom*xref-follow-and-close (orig-fn &rest args) (defun doom*xref-follow-and-close (orig-fn &rest args)
"Jump to the xref on the current line, select its window and close the popup "Jump to the xref on the current line, select its window and close the popup

View file

@ -74,7 +74,7 @@
(def-package! magit (def-package! magit
:commands magit-status :commands (magit-status magit-blame)
:config :config
(set! :popup "^\\*magit" :regexp t) (set! :popup "^\\*magit" :regexp t)
(map! :map magit-mode-map (map! :map magit-mode-map

View file

@ -259,8 +259,8 @@ project root). Excludes the file basename. See `doom-buffer-name' for that."
(when (and path (equal "" (car path))) (when (and path (equal "" (car path)))
(setq path (cdr path))) (setq path (cdr path)))
(while (and path (<= (length output) (- max-length 4))) (while (and path (<= (length output) (- max-length 4)))
(setq output (concat (car path) "/" output)) (setq output (concat (car path) "/" output)
(setq path (cdr path))) path (cdr path)))
(when path (when path
(setq output (concat "../" output))) (setq output (concat "../" output)))
(unless (string-suffix-p "/" output) (unless (string-suffix-p "/" output)