From 25fa4e019c6fb7e1caa5b44f0e129febdceb02c6 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 14 May 2017 09:49:09 +0200 Subject: [PATCH] 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 --- core/autoload/packages.el | 14 +++++++------- core/core-editor.el | 2 +- core/core-popups.el | 20 ++++++++++---------- modules/feature/version-control/+git.el | 2 +- modules/ui/doom-modeline/config.el | 4 ++-- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/core/autoload/packages.el b/core/autoload/packages.el index d8b16ebda..60285236a 100644 --- a/core/autoload/packages.el +++ b/core/autoload/packages.el @@ -11,7 +11,7 @@ (when last-refresh (setq doom--last-refresh 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) (persistent-soft-store '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, quelpa or nil (if not installed)." (doom-initialize) - (unless (quelpa-setup-p) - (error "Could not initialize quelpa")) (cond ((let ((plist (cdr (assq name doom-packages)))) (and (not (plist-get plist :pin)) + (or (quelpa-setup-p) + (error "Could not initialize quelpa")) (or (assq name quelpa-cache) (plist-get plist :recipe)))) 'quelpa) ((assq name package-alist) - 'elpa))) + 'elpa) + (t + (error "%s package not installed" name)))) ;;;###autoload (defun doom-package-outdated-p (name) @@ -46,7 +48,7 @@ list of the package." (let ((recipe (assq name quelpa-cache)) (dir (expand-file-name (symbol-name name) quelpa-build-dir)) (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) old-version))) ('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. Be careful not to use it in a loop." (doom-initialize-packages t) - (unless (quelpa-setup-p) - (error "Could not initialize quelpa")) (delq nil (mapcar (lambda (pkgsym) (or (assq pkgsym doom-packages) diff --git a/core/core-editor.el b/core/core-editor.el index 249b60c3d..7e6494197 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -67,7 +67,7 @@ modes are active and the buffer is read-only.") recentf-filename-handlers '(abbreviate-file-name)) (quiet! (recentf-mode 1)) -;; Ediff +;; Ediff: use existing frame instead of creating a new one (add-hook! ediff-load (setq ediff-diff-options "-w" ediff-split-window-function #'split-window-horizontally diff --git a/core/core-popups.el b/core/core-popups.el index 39815d846..32ff6fb9d 100644 --- a/core/core-popups.el +++ b/core/core-popups.el @@ -392,6 +392,13 @@ the command buffer." (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 ;; Neotree has its own window/popup management built-in, which is difficult to ;; police. For example, switching perspectives will cause neotree to forget it @@ -406,22 +413,15 @@ the command buffer." (doom-popup-buffer buf))) -(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! quickrun + ;; don't auto-focus quickrun windows, shackle handles that + (setq quickrun-focus-p nil)) (after! twittering-mode (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 (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 diff --git a/modules/feature/version-control/+git.el b/modules/feature/version-control/+git.el index 0c5778b6f..69f162132 100644 --- a/modules/feature/version-control/+git.el +++ b/modules/feature/version-control/+git.el @@ -74,7 +74,7 @@ (def-package! magit - :commands magit-status + :commands (magit-status magit-blame) :config (set! :popup "^\\*magit" :regexp t) (map! :map magit-mode-map diff --git a/modules/ui/doom-modeline/config.el b/modules/ui/doom-modeline/config.el index 5e1f2a6d7..63cbb37e2 100644 --- a/modules/ui/doom-modeline/config.el +++ b/modules/ui/doom-modeline/config.el @@ -259,8 +259,8 @@ project root). Excludes the file basename. See `doom-buffer-name' for that." (when (and path (equal "" (car path))) (setq path (cdr path))) (while (and path (<= (length output) (- max-length 4))) - (setq output (concat (car path) "/" output)) - (setq path (cdr path))) + (setq output (concat (car path) "/" output) + path (cdr path))) (when path (setq output (concat "../" output))) (unless (string-suffix-p "/" output)