General minor refactor & comment updates
This commit is contained in:
parent
ddadb79952
commit
f2c02e32c8
3 changed files with 29 additions and 30 deletions
|
@ -75,8 +75,7 @@ kills the buffer. If FORCE-P, force the deletion (don't ask for confirmation)."
|
||||||
((not (or force-p (y-or-n-p (format "Really delete %s?" fbase))))
|
((not (or force-p (y-or-n-p (format "Really delete %s?" fbase))))
|
||||||
(message "Aborted")
|
(message "Aborted")
|
||||||
nil)
|
nil)
|
||||||
(t
|
((unwind-protect
|
||||||
(unwind-protect
|
|
||||||
(progn (delete-file path) t)
|
(progn (delete-file path) t)
|
||||||
(let ((short-path (file-relative-name path (doom-project-root))))
|
(let ((short-path (file-relative-name path (doom-project-root))))
|
||||||
(if (file-exists-p path)
|
(if (file-exists-p path)
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
(load! cache)
|
(load! cache)
|
||||||
|
|
||||||
;;; Private functions
|
;;; Private functions
|
||||||
(defsubst doom--sort-alpha (it other)
|
|
||||||
(string-lessp (symbol-name (car it))
|
|
||||||
(symbol-name (car other))))
|
|
||||||
|
|
||||||
(defun doom--packages-choose (prompt)
|
(defun doom--packages-choose (prompt)
|
||||||
(let ((table (cl-loop for pkg in package-alist
|
(let ((table (cl-loop for pkg in package-alist
|
||||||
|
@ -365,7 +362,8 @@ package.el as appropriate."
|
||||||
"QUELPA")
|
"QUELPA")
|
||||||
(t
|
(t
|
||||||
"ELPA"))))
|
"ELPA"))))
|
||||||
(sort (cl-copy-list packages) #'doom--sort-alpha)
|
(cl-sort (cl-copy-list packages) #'string-lessp
|
||||||
|
:key #'car)
|
||||||
"\n")))))
|
"\n")))))
|
||||||
(error "Aborted!"))
|
(error "Aborted!"))
|
||||||
|
|
||||||
|
@ -400,7 +398,8 @@ package.el as appropriate."
|
||||||
(doom-initialize-packages)
|
(doom-initialize-packages)
|
||||||
(print! "Looking for outdated packages...")
|
(print! "Looking for outdated packages...")
|
||||||
(doom-refresh-packages-maybe doom-debug-mode)
|
(doom-refresh-packages-maybe doom-debug-mode)
|
||||||
(let ((packages (sort (doom-get-outdated-packages) #'doom--sort-alpha)))
|
(let ((packages (cl-sort (cl-copy-list (doom-get-outdated-packages)) #'string-lessp
|
||||||
|
:key #'car)))
|
||||||
(cond ((not packages)
|
(cond ((not packages)
|
||||||
(print! (green "Everything is up-to-date"))
|
(print! (green "Everything is up-to-date"))
|
||||||
nil)
|
nil)
|
||||||
|
@ -411,7 +410,7 @@ package.el as appropriate."
|
||||||
(length packages)
|
(length packages)
|
||||||
(let ((max-len
|
(let ((max-len
|
||||||
(or (car (sort (mapcar (lambda (it) (length (symbol-name (car it)))) packages)
|
(or (car (sort (mapcar (lambda (it) (length (symbol-name (car it)))) packages)
|
||||||
(lambda (it other) (> it other))))
|
#'>))
|
||||||
10)))
|
10)))
|
||||||
(mapconcat
|
(mapconcat
|
||||||
(lambda (pkg)
|
(lambda (pkg)
|
||||||
|
|
|
@ -248,29 +248,28 @@ to least)."
|
||||||
(setq doom--refreshed-p t)
|
(setq doom--refreshed-p t)
|
||||||
(package-initialize))))
|
(package-initialize))))
|
||||||
;; Ensure core packages are installed
|
;; Ensure core packages are installed
|
||||||
(let ((core-packages (cl-remove-if #'package-installed-p doom-core-packages)))
|
(when-let* ((core-packages (cl-remove-if #'package-installed-p doom-core-packages)))
|
||||||
(when core-packages
|
(message "Installing core packages")
|
||||||
(message "Installing core packages")
|
(unless doom--refreshed-p
|
||||||
(unless doom--refreshed-p
|
(package-refresh-contents))
|
||||||
(package-refresh-contents))
|
(dolist (package core-packages)
|
||||||
(dolist (package core-packages)
|
(let ((inhibit-message t))
|
||||||
(let ((inhibit-message t))
|
(package-install package))
|
||||||
(package-install package))
|
(if (package-installed-p package)
|
||||||
(if (package-installed-p package)
|
(message "✓ Installed %s" package)
|
||||||
(message "✓ Installed %s" package)
|
(error "✕ Couldn't install %s" package)))
|
||||||
(error "✕ Couldn't install %s" package)))
|
(message "Installing core packages...done"))
|
||||||
(message "Installing core packages...done")))
|
|
||||||
(unless noninteractive
|
(unless noninteractive
|
||||||
(add-hook 'doom-pre-init-hook #'doom|refresh-cache)))
|
(add-hook 'doom-pre-init-hook #'doom|refresh-cache)))
|
||||||
;; autoloads file
|
;; Load autoloads file
|
||||||
(doom-initialize-autoloads))
|
(doom-initialize-autoloads))
|
||||||
;; initialize Doom core
|
;; Initialize Doom core
|
||||||
(unless noninteractive
|
(unless noninteractive
|
||||||
(require 'core-ui)
|
(require 'core-ui)
|
||||||
(require 'core-editor)
|
(require 'core-editor)
|
||||||
(require 'core-projects)
|
(require 'core-projects)
|
||||||
(require 'core-keybinds))
|
(require 'core-keybinds))
|
||||||
;; bootstrap Doom
|
;; Bootstrap Doom
|
||||||
(unless doom-init-p
|
(unless doom-init-p
|
||||||
(unless noninteractive
|
(unless noninteractive
|
||||||
(add-hook! 'doom-reload-hook
|
(add-hook! 'doom-reload-hook
|
||||||
|
@ -517,6 +516,7 @@ MODULES is an malformed plist of modules to load."
|
||||||
(and (plist-member plist :when) (not (eval (plist-get plist :when) t)))
|
(and (plist-member plist :when) (not (eval (plist-get plist :when) t)))
|
||||||
(and (plist-member plist :unless) (eval (plist-get plist :unless) t))))
|
(and (plist-member plist :unless) (eval (plist-get plist :unless) t))))
|
||||||
`(progn
|
`(progn
|
||||||
|
;; TODO Replace with custom use-package keyword
|
||||||
,(when-let* ((defer (plist-get plist :defer))
|
,(when-let* ((defer (plist-get plist :defer))
|
||||||
(value (or (car-safe defer) defer)))
|
(value (or (car-safe defer) defer)))
|
||||||
(setq plist (plist-put plist :defer (or (cdr-safe defer) t)))
|
(setq plist (plist-put plist :defer (or (cdr-safe defer) t)))
|
||||||
|
@ -554,8 +554,7 @@ to have them return non-nil (or exploit that to overwrite Doom's config)."
|
||||||
package
|
package
|
||||||
(substring (symbol-name when) 1)))
|
(substring (symbol-name when) 1)))
|
||||||
,@body)))
|
,@body)))
|
||||||
(t
|
((error "'%s' isn't a valid hook for def-package-hook!" when))))
|
||||||
(error "'%s' isn't a valid hook for def-package-hook!" when))))
|
|
||||||
|
|
||||||
(defmacro load! (filesym &optional path noerror)
|
(defmacro load! (filesym &optional path noerror)
|
||||||
"Load a file relative to the current executing file (`load-file-name').
|
"Load a file relative to the current executing file (`load-file-name').
|
||||||
|
@ -750,11 +749,13 @@ loads MODULE SUBMODULE's packages.el file."
|
||||||
;; Cross-module configuration
|
;; Cross-module configuration
|
||||||
;;
|
;;
|
||||||
|
|
||||||
;; I needed a way to reliably cross-configure modules without worrying about
|
;; I needed a way to reliably cross-configure modules without littering my
|
||||||
;; whether they were enabled or not, so I wrote `set!'. If a setting doesn't
|
;; modules with `after!' blocks or testing whether they were enabled, so I wrote
|
||||||
;; exist at runtime, the `set!' call is ignored and its arguments are left
|
;; `set!'. If a setting doesn't exist at runtime, the `set!' call is ignored and
|
||||||
;; unevaluated (and entirely omitted when byte-compiled).
|
;; its arguments are left unevaluated (and entirely omitted when byte-compiled).
|
||||||
(defvar doom-settings nil)
|
|
||||||
|
(defvar doom-settings nil
|
||||||
|
"An alist mapping setting keywords to functions.")
|
||||||
|
|
||||||
(defmacro def-setting! (keyword arglist &optional docstring &rest forms)
|
(defmacro def-setting! (keyword arglist &optional docstring &rest forms)
|
||||||
"Define a setting. Like `defmacro', this should return a form to be executed
|
"Define a setting. Like `defmacro', this should return a form to be executed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue