General & minor refactor

This commit is contained in:
Henrik Lissner 2017-12-23 22:13:48 -05:00
parent 1ef50bd5fa
commit 89f07f88c5
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 31 additions and 30 deletions

View file

@ -77,7 +77,7 @@ missing) and shouldn't be deleted.")
"The load path of built in Emacs libraries.") "The load path of built in Emacs libraries.")
(defvar doom--package-load-path () (defvar doom--package-load-path ()
"The load path of package libraries installed via ELPA or QUELPA.") "The load path of package libraries installed via ELPA and QUELPA.")
(defvar doom--base-load-path (defvar doom--base-load-path
(append (list doom-core-dir doom-modules-dir) (append (list doom-core-dir doom-modules-dir)
@ -130,31 +130,34 @@ are installed.
If you byte-compile core/core.el, this function will be avoided to speed up If you byte-compile core/core.el, this function will be avoided to speed up
startup." startup."
;; Called early during initialization; only use native functions! ;; Called early during initialization; only use native (and cl-lib) functions!
(when (or force-p (not doom-init-p)) (when (or force-p (not doom-init-p))
(setq load-path doom--base-load-path ;; Speed things up with a `load-path' for only the bare essentials
package-activated-list nil) (let ((load-path doom--base-load-path))
;; Ensure core folders exist ;; Ensure core folders exist, otherwise we get errors
(dolist (dir (list doom-local-dir doom-etc-dir doom-cache-dir doom-packages-dir)) (dolist (dir (list doom-local-dir doom-etc-dir doom-cache-dir doom-packages-dir))
(unless (file-directory-p dir) (unless (file-directory-p dir)
(make-directory dir t))) (make-directory dir t)))
;; Ensure core packages are installed ;; Ensure package.el is initialized; we use its state
(condition-case _ (package-initialize t) (setq package-activated-list nil)
('error (package-refresh-contents) (condition-case _ (package-initialize t)
(setq doom--refreshed-p t) ('error (package-refresh-contents)
(package-initialize t))) (setq doom--refreshed-p t)
(let ((core-packages (cl-remove-if #'package-installed-p doom-core-packages))) (package-initialize t)))
(when core-packages ;; Ensure core packages are installed
(message "Installing core packages") (let ((core-packages (cl-remove-if #'package-installed-p doom-core-packages)))
(package-refresh-contents) (when core-packages
(dolist (package core-packages) (message "Installing core packages")
(let ((inhibit-message t)) (unless doom--refreshed-p
(package-install package)) (package-refresh-contents))
(if (package-installed-p package) (dolist (package core-packages)
(message "✓ Installed %s" package) (let ((inhibit-message t))
(error "✕ Couldn't install %s" package))) (package-install package))
(message "Installing core packages...done"))) (if (package-installed-p package)
(setq doom-init-p t))) (message "✓ Installed %s" package)
(error "✕ Couldn't install %s" package)))
(message "Installing core packages...done")))
(setq doom-init-p t))))
(defun doom-initialize-load-path (&optional force-p) (defun doom-initialize-load-path (&optional force-p)
(when (or force-p (not doom--package-load-path)) (when (or force-p (not doom--package-load-path))

View file

@ -259,8 +259,7 @@ local value, whether or not it's permanent-local. Therefore, we cycle
(def-package! hideshow ; built-in (def-package! hideshow ; built-in
:commands (hs-minor-mode hs-toggle-hiding hs-already-hidden-p) :commands (hs-minor-mode hs-toggle-hiding hs-already-hidden-p)
:config :config (setq hs-hide-comments-when-hiding-all nil))
(setq hs-hide-comments-when-hiding-all nil))
(def-package! highlight-indentation (def-package! highlight-indentation
:commands (highlight-indentation-mode highlight-indentation-current-column-mode)) :commands (highlight-indentation-mode highlight-indentation-current-column-mode))
@ -310,9 +309,8 @@ local value, whether or not it's permanent-local. Therefore, we cycle
;; Helps us distinguish stacked delimiter pairs. Especially in parentheses-drunk ;; Helps us distinguish stacked delimiter pairs. Especially in parentheses-drunk
;; languages like Lisp. ;; languages like Lisp.
(def-package! rainbow-delimiters (def-package! rainbow-delimiters
:commands rainbow-delimiters-mode :hook (lisp-mode . rainbow-delimiters-mode)
:config (setq rainbow-delimiters-max-face-count 3) :config (setq rainbow-delimiters-max-face-count 3))
:init (add-hook 'lisp-mode-hook #'rainbow-delimiters-mode))
;; For a distractions-free-like UI, that dynamically resizes margets and can ;; For a distractions-free-like UI, that dynamically resizes margets and can
;; center a buffer. ;; center a buffer.