General refactor & docstring updates

This commit is contained in:
Henrik Lissner 2017-10-05 16:17:52 +02:00
parent 11dc929355
commit cd7ab060e0
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
5 changed files with 17 additions and 27 deletions

View file

@ -135,30 +135,27 @@ base by `doom!' and for calculating how many packages exist.")
(defun doom-initialize (&optional force-p) (defun doom-initialize (&optional force-p)
"Initialize installed packages (using package.el) and ensure the core packages "Initialize installed packages (using package.el) and ensure the core packages
are installed. If you byte-compile core/core.el, this function will be avoided are installed.
to speed up startup."
If you byte-compile core/core.el, this function will be avoided to speed up
startup."
;; Called early during initialization; only use native functions! ;; Called early during initialization; only use native functions!
(when (or (not doom-package-init-p) force-p) (when (or (not doom-package-init-p) force-p)
(setq load-path doom--base-load-path (setq load-path doom--base-load-path
package-activated-list nil) package-activated-list nil)
;; Ensure core folders exist ;; Ensure core folders exist
(dolist (dir (list doom-local-dir doom-etc-dir doom-cache-dir package-user-dir)) (dolist (dir (list doom-local-dir doom-etc-dir doom-cache-dir package-user-dir))
(unless (file-directory-p dir) (unless (file-directory-p dir)
(make-directory dir t))) (make-directory dir t)))
(package-initialize t) (package-initialize t)
;; Sure, we could let `package-initialize' fill `load-path', but package ;; We could let `package-initialize' fill `load-path', but it costs precious
;; activation costs precious milliseconds and does other stuff I don't ;; milliseconds and does other stuff I don't need (like load autoload
;; really care about (like load autoload files). My premature optimization ;; files). My premature optimization quota isn't filled yet.
;; quota isn't filled yet.
;; ;;
;; Also, in some edge cases involving package initialization during a ;; Also, in some edge cases involving package initialization during a
;; non-interactive session, `package-initialize' fails to fill `load-path'. ;; non-interactive session, `package-initialize' fails to fill `load-path'.
;; If we want something done right, do it ourselves!
(setq doom--package-load-path (directory-files package-user-dir t "^[^.]" t) (setq doom--package-load-path (directory-files package-user-dir t "^[^.]" t)
load-path (append load-path doom--package-load-path)) load-path (append load-path doom--package-load-path))
;; Ensure core packages are installed ;; Ensure core packages are installed
(dolist (pkg doom-core-packages) (dolist (pkg doom-core-packages)
(unless (package-installed-p pkg) (unless (package-installed-p pkg)
@ -170,12 +167,9 @@ to speed up startup."
(if (package-installed-p pkg) (if (package-installed-p pkg)
(message "Installed %s" pkg) (message "Installed %s" pkg)
(error "Couldn't install %s" pkg)))) (error "Couldn't install %s" pkg))))
(load "quelpa" nil t) (load "quelpa" nil t)
(load "use-package" nil t) (load "use-package" nil t)
(setq doom-package-init-p t) (setq doom-package-init-p t)
(unless noninteractive (unless noninteractive
(message "Doom initialized")))) (message "Doom initialized"))))
@ -194,6 +188,7 @@ If FORCE-P is non-nil, do it even if they are.
This aggressively reloads core autoload files." This aggressively reloads core autoload files."
(doom-initialize force-p) (doom-initialize force-p)
(let ((noninteractive t) (let ((noninteractive t)
(load-prefer-newer t)
(load-fn (load-fn
(lambda (file &optional noerror) (lambda (file &optional noerror)
(condition-case-unless-debug ex (condition-case-unless-debug ex
@ -230,14 +225,10 @@ This aggressively reloads core autoload files."
:rehash-threshold 1.0))) :rehash-threshold 1.0)))
(let (mode) (let (mode)
(dolist (m modules) (dolist (m modules)
(cond ((keywordp m) (cond ((keywordp m) (setq mode m))
(setq mode m)) ((not mode) (error "No namespace specified on `doom!' for %s" m))
((not mode) ((listp m) (doom-module-enable mode (car m) (cdr m)))
(error "No namespace specified on `doom!' for %s" m)) (t (doom-module-enable mode m))))))
((listp m)
(doom-module-enable mode (car m) (cdr m)))
(t
(doom-module-enable mode m))))))
(defun doom-module-path (module submodule &optional file) (defun doom-module-path (module submodule &optional file)
"Get the full path to a module: e.g. :lang emacs-lisp maps to "Get the full path to a module: e.g. :lang emacs-lisp maps to

View file

@ -215,8 +215,7 @@ not in a popup, close all popups with an :autoclose property."
(cond ((doom-popup-p) (cond ((doom-popup-p)
(unless (doom-popup-property :noesc) (unless (doom-popup-property :noesc)
(delete-window))) (delete-window)))
(t (t (doom/popup-close-all))))
(doom/popup-close-all))))
(add-hook '+evil-esc-hook #'doom|popup-close-maybe t) (add-hook '+evil-esc-hook #'doom|popup-close-maybe t)
;; Make evil-mode cooperate with popups ;; Make evil-mode cooperate with popups

View file

@ -87,8 +87,9 @@ they are absolute."
(defun doom|autoload-project-mode () (defun doom|autoload-project-mode ()
"Auto-enable projects listed in `doom-project', which is meant to be set from "Auto-enable projects listed in `doom-project', which is meant to be set from
.dir-locals.el files." .dir-locals.el files."
(dolist (mode doom-project) (cl-loop for mode in doom-project
(funcall mode))) unless (symbol-value mode)
do (funcall mode)))
(add-hook 'after-change-major-mode-hook #'doom|autoload-project-mode) (add-hook 'after-change-major-mode-hook #'doom|autoload-project-mode)
(defmacro def-project-mode! (name &rest plist) (defmacro def-project-mode! (name &rest plist)

View file

@ -92,7 +92,7 @@
;; --- evil hacks ------------------------- ;; --- evil hacks -------------------------
(defvar +evil-esc-hook '(t) (defvar +evil-esc-hook '(t)
"A hook run after ESC is pressed in normal mode (invoked by "A hook run after ESC is pressed in normal mode (invoked by
`evil-force-normal-state'). If a hook returns non-nil, all hooks after it are `evil-force-normal-state'). If any hook returns non-nil, all hooks after it are
ignored.") ignored.")
(defun +evil*attach-escape-hook () (defun +evil*attach-escape-hook ()

View file

@ -1,6 +1,5 @@
;;; lang/web/autoload/html.el -*- lexical-binding: t; -*- ;;; lang/web/autoload/html.el -*- lexical-binding: t; -*-
;;;###autoload
(defvar +web-entities-list (defvar +web-entities-list
[[" " " "] [" " ""] [" " ""] [" " ""] [[" " " "] [" " ""] [" " ""] [" " ""]
["‏" ""] ["‎" ""] ["‍" ""] ["‌" ""] ["‏" ""] ["‎" ""] ["‍" ""] ["‌" ""]