Minor refactors & reformatting
This commit is contained in:
parent
3e5cf3de09
commit
e00bfc7612
6 changed files with 27 additions and 18 deletions
|
@ -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"
|
'(("has diverged from"
|
||||||
. "^Reset [^ ]+ to branch")
|
. "^Reset [^ ]+ to branch")
|
||||||
("but recipe specifies a URL of"
|
("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)
|
so Doom will recommend the one that reverts a package back to its (or target)
|
||||||
original state.")
|
original state.")
|
||||||
|
|
||||||
|
|
||||||
;; HACK Remove dired & magit options from prompt, since they're inaccessible in
|
;; HACK Remove dired & magit options from prompt, since they're inaccessible in
|
||||||
;; noninteractive sessions.
|
;; noninteractive sessions.
|
||||||
(advice-add #'straight-vc-git--popup-raw :override #'straight--popup-raw)
|
(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 ""))))))
|
(y-or-n-p (format! "%s" (or prompt ""))))))
|
||||||
|
|
||||||
(defun doom--straight-recommended-option-p (prompt option)
|
(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)
|
if (string-match-p prompt-re prompt)
|
||||||
return (string-match-p opt-re option)))
|
return (string-match-p opt-re option)))
|
||||||
|
|
||||||
|
@ -266,7 +271,7 @@ original state.")
|
||||||
:around #'straight--popup-raw
|
:around #'straight--popup-raw
|
||||||
(if doom-interactive-mode
|
(if doom-interactive-mode
|
||||||
(funcall orig-fn prompt actions)
|
(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
|
;; 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.
|
;; when C-c is the proper way to abort batch Emacs.
|
||||||
(delq! "C-g" actions 'assoc)
|
(delq! "C-g" actions 'assoc)
|
||||||
|
@ -293,7 +298,7 @@ original state.")
|
||||||
(print! "%2s) %s" (1+ (length options))
|
(print! "%2s) %s" (1+ (length options))
|
||||||
(if (doom--straight-recommended-option-p prompt desc)
|
(if (doom--straight-recommended-option-p prompt desc)
|
||||||
(progn
|
(progn
|
||||||
(setq doom--cli-straight-discard-options nil)
|
(setq doom--straight-discard-options nil)
|
||||||
(green (concat desc " (Recommended)")))
|
(green (concat desc " (Recommended)")))
|
||||||
desc))))
|
desc))))
|
||||||
(terpri)
|
(terpri)
|
||||||
|
|
|
@ -93,7 +93,7 @@ package's name as a symbol, and whose CDR is the plist supplied to its
|
||||||
straight-fix-org nil)
|
straight-fix-org nil)
|
||||||
|
|
||||||
(defadvice! doom--read-pinned-packages-a (orig-fn &rest args)
|
(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
|
:around #'straight--lockfile-read-all
|
||||||
(append (apply orig-fn args) ; lockfiles still take priority
|
(append (apply orig-fn args) ; lockfiles still take priority
|
||||||
(doom-package-pinned-list)))
|
(doom-package-pinned-list)))
|
||||||
|
|
17
core/core.el
17
core/core.el
|
@ -5,6 +5,10 @@
|
||||||
(error "Detected Emacs v%s. Doom only supports Emacs 26 and newer"
|
(error "Detected Emacs v%s. Doom only supports Emacs 26 and newer"
|
||||||
emacs-version)))
|
emacs-version)))
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Variables
|
||||||
|
|
||||||
(defconst doom-version "2.0.9"
|
(defconst doom-version "2.0.9"
|
||||||
"Current version of Doom Emacs.")
|
"Current version of Doom Emacs.")
|
||||||
|
|
||||||
|
@ -140,7 +144,7 @@ users).")
|
||||||
;;; Custom error types
|
;;; Custom error types
|
||||||
(define-error 'doom-error "Error in Doom Emacs core")
|
(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-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-module-error "Error in a Doom module" 'doom-error)
|
||||||
(define-error 'doom-private-error "Error in private config" 'doom-error)
|
(define-error 'doom-private-error "Error in private config" 'doom-error)
|
||||||
(define-error 'doom-package-error "Error with packages" 'doom-error)
|
(define-error 'doom-package-error "Error with packages" 'doom-error)
|
||||||
|
@ -398,7 +402,7 @@ intervals."
|
||||||
t)
|
t)
|
||||||
(push req packages))
|
(push req packages))
|
||||||
((error debug)
|
((error debug)
|
||||||
(message "Failed to load '%s' package incrementally, because: %s"
|
(message "Failed to load %S package incrementally, because: %s"
|
||||||
req e)))
|
req e)))
|
||||||
(if (not packages)
|
(if (not packages)
|
||||||
(doom-log "Finished incremental loading")
|
(doom-log "Finished incremental loading")
|
||||||
|
@ -504,14 +508,17 @@ to least)."
|
||||||
;; Load shell environment, optionally generated from 'doom env'. No need
|
;; Load shell environment, optionally generated from 'doom env'. No need
|
||||||
;; to do so if we're in terminal Emacs, where Emacs correctly inherits
|
;; to do so if we're in terminal Emacs, where Emacs correctly inherits
|
||||||
;; your shell environment there.
|
;; your shell environment there.
|
||||||
(and (or (display-graphic-p)
|
(if (or (display-graphic-p)
|
||||||
(daemonp))
|
(daemonp))
|
||||||
(doom-load-envvars-file doom-env-file 'noerror))
|
(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)
|
(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-packages "core-packages")
|
||||||
(autoload 'doom-initialize-core-packages "core-packages")
|
(autoload 'doom-initialize-core-packages "core-packages")
|
||||||
(with-eval-after-load 'package (require 'core-packages))
|
(with-eval-after-load 'package (require 'core-packages))
|
||||||
|
|
|
@ -252,8 +252,7 @@ The point of this is to avoid Emacs locking up indexing massive file trees."
|
||||||
(directory (or in project-root))
|
(directory (or in project-root))
|
||||||
(args (concat (if all-files " -uu")
|
(args (concat (if all-files " -uu")
|
||||||
(unless recursive " --maxdepth 1")
|
(unless recursive " --maxdepth 1")
|
||||||
" "
|
" " (mapconcat #'shell-quote-argument args " "))))
|
||||||
(mapconcat #'shell-quote-argument args " "))))
|
|
||||||
(setq deactivate-mark t)
|
(setq deactivate-mark t)
|
||||||
(counsel-rg
|
(counsel-rg
|
||||||
(or query
|
(or query
|
||||||
|
|
|
@ -66,8 +66,6 @@
|
||||||
;; HACK The fringe cannot have a buffer-local remapping on Emacs <= 26, so
|
;; 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
|
;; we jump through hoops to reset it (globally) whenever it is likely
|
||||||
;; that the fringe will have lost its background color.
|
;; 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
|
(add-hook! '(doom-load-theme-hook doom-reload-hook) :append
|
||||||
#'solaire-mode-reset)
|
#'solaire-mode-reset)
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ flycheck indicators moved to the right fringe.")
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Packages
|
;;; Packages
|
||||||
|
|
||||||
(use-package! git-gutter
|
(use-package! git-gutter
|
||||||
:commands git-gutter:revert-hunk git-gutter:stage-hunk
|
:commands git-gutter:revert-hunk git-gutter:stage-hunk
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue