Minor refactors & reformatting

This commit is contained in:
Henrik Lissner 2020-05-25 02:20:26 -04:00
parent 3e5cf3de09
commit e00bfc7612
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395
6 changed files with 27 additions and 18 deletions

View File

@ -220,9 +220,13 @@ BODY will be run when this dispatcher is called."
;;
;;; Straight hacks
;;; straight.el hacks
(defvar doom--cli-straight-discard-options
;; Straight was designed primarily for interactive use, in an interactive Emacs
;; session, but Doom does its package management in the terminal. Some things
;; must be modified get straight to behave and improve its UX for our users.
(defvar doom--straight-discard-options
'(("has diverged from"
. "^Reset [^ ]+ to branch")
("but recipe specifies a URL of"
@ -243,6 +247,7 @@ It may not be obvious to users what they should do for some straight prompts,
so Doom will recommend the one that reverts a package back to its (or target)
original state.")
;; HACK Remove dired & magit options from prompt, since they're inaccessible in
;; noninteractive sessions.
(advice-add #'straight-vc-git--popup-raw :override #'straight--popup-raw)
@ -257,7 +262,7 @@ original state.")
(y-or-n-p (format! "%s" (or prompt ""))))))
(defun doom--straight-recommended-option-p (prompt option)
(cl-loop for (prompt-re . opt-re) in doom--cli-straight-discard-options
(cl-loop for (prompt-re . opt-re) in doom--straight-discard-options
if (string-match-p prompt-re prompt)
return (string-match-p opt-re option)))
@ -266,7 +271,7 @@ original state.")
:around #'straight--popup-raw
(if doom-interactive-mode
(funcall orig-fn prompt actions)
(let ((doom--cli-straight-discard-options doom--cli-straight-discard-options))
(let ((doom--straight-discard-options doom--straight-discard-options))
;; We can't intercept C-g, so no point displaying any options for this key
;; when C-c is the proper way to abort batch Emacs.
(delq! "C-g" actions 'assoc)
@ -293,7 +298,7 @@ original state.")
(print! "%2s) %s" (1+ (length options))
(if (doom--straight-recommended-option-p prompt desc)
(progn
(setq doom--cli-straight-discard-options nil)
(setq doom--straight-discard-options nil)
(green (concat desc " (Recommended)")))
desc))))
(terpri)

View File

@ -93,7 +93,7 @@ package's name as a symbol, and whose CDR is the plist supplied to its
straight-fix-org nil)
(defadvice! doom--read-pinned-packages-a (orig-fn &rest args)
"Read from `doom-pinned-packages' on top of straight's lockfiles."
"Read `:pin's in `doom-packages' on top of straight's lockfiles."
:around #'straight--lockfile-read-all
(append (apply orig-fn args) ; lockfiles still take priority
(doom-package-pinned-list)))

View File

@ -5,6 +5,10 @@
(error "Detected Emacs v%s. Doom only supports Emacs 26 and newer"
emacs-version)))
;;
;;; Variables
(defconst doom-version "2.0.9"
"Current version of Doom Emacs.")
@ -140,7 +144,7 @@ users).")
;;; Custom error types
(define-error 'doom-error "Error in Doom Emacs core")
(define-error 'doom-hook-error "Error in a Doom startup hook" 'doom-error)
(define-error 'doom-autoload-error "Error in an autoloads file" 'doom-error)
(define-error 'doom-autoload-error "Error in Doom's autoloads file" 'doom-error)
(define-error 'doom-module-error "Error in a Doom module" 'doom-error)
(define-error 'doom-private-error "Error in private config" 'doom-error)
(define-error 'doom-package-error "Error with packages" 'doom-error)
@ -398,7 +402,7 @@ intervals."
t)
(push req packages))
((error debug)
(message "Failed to load '%s' package incrementally, because: %s"
(message "Failed to load %S package incrementally, because: %s"
req e)))
(if (not packages)
(doom-log "Finished incremental loading")
@ -504,14 +508,17 @@ to least)."
;; Load shell environment, optionally generated from 'doom env'. No need
;; to do so if we're in terminal Emacs, where Emacs correctly inherits
;; your shell environment there.
(and (or (display-graphic-p)
(daemonp))
(doom-load-envvars-file doom-env-file 'noerror))
(if (or (display-graphic-p)
(daemonp))
(doom-load-envvars-file doom-env-file 'noerror))
;; Loads `use-package' and our module helper library
;; Loads `use-package' and all the helper macros modules (and users) can use
;; to configure their packages.
(require 'core-modules)
;; In case we want to use package.el or straight via M-x later
;; There's a chance the user will want to use package.el or straight later
;; on in this interactive session. If that's the case, make sure they're
;; properly initialized when they do.
(autoload 'doom-initialize-packages "core-packages")
(autoload 'doom-initialize-core-packages "core-packages")
(with-eval-after-load 'package (require 'core-packages))

View File

@ -252,8 +252,7 @@ The point of this is to avoid Emacs locking up indexing massive file trees."
(directory (or in project-root))
(args (concat (if all-files " -uu")
(unless recursive " --maxdepth 1")
" "
(mapconcat #'shell-quote-argument args " "))))
" " (mapconcat #'shell-quote-argument args " "))))
(setq deactivate-mark t)
(counsel-rg
(or query

View File

@ -66,8 +66,6 @@
;; HACK The fringe cannot have a buffer-local remapping on Emacs <= 26, so
;; we jump through hoops to reset it (globally) whenever it is likely
;; that the fringe will have lost its background color.
;; Prevent color glitches when reloading either DOOM or loading a new theme
(add-hook! '(doom-load-theme-hook doom-reload-hook) :append
#'solaire-mode-reset)

View File

@ -17,7 +17,7 @@ flycheck indicators moved to the right fringe.")
;;
;; Packages
;;; Packages
(use-package! git-gutter
:commands git-gutter:revert-hunk git-gutter:stage-hunk