General refactor (use map.el more)

+ map-delete is shorter and faster than assq-delete-all
+ map-put is simpler than the delete-then-set workflow
+ map-merge is great for merging default and user settings
This commit is contained in:
Henrik Lissner 2018-01-06 23:54:12 -05:00
parent 2eeb6ce0d9
commit 392f04446f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
7 changed files with 27 additions and 42 deletions

View file

@ -205,7 +205,7 @@ Used by `doom//packages-install'."
(when (and (not (package-installed-p name))
(quelpa-setup-p)
(assq name quelpa-cache))
(setq quelpa-cache (assq-delete-all name quelpa-cache))
(map-delete quelpa-cache name)
(quelpa-save-cache)
(let ((path (expand-file-name (symbol-name name) quelpa-build-dir)))
(when (file-exists-p path)
@ -304,7 +304,7 @@ package.el as appropriate."
(unless (quelpa-setup-p)
(error "Could not initialize QUELPA"))
(when (assq name quelpa-cache)
(setq quelpa-cache (assq-delete-all name quelpa-cache))
(map-delete quelpa-cache name)
(quelpa-save-cache)
(setq quelpa-p t))
(package-delete (cadr (assq name package-alist)) force-p)

View file

@ -146,8 +146,7 @@ extension, try to guess one."
;; editorconfig to ignore indentation. I prefer dynamic indentation support
;; built into Emacs.
(dolist (mode '(emacs-lisp-mode lisp-mode))
(setq editorconfig-indentation-alist
(assq-delete-all mode editorconfig-indentation-alist)))
(map-delete editorconfig-indentation-alist mode))
(defvar whitespace-style)
(defun doom|editorconfig-whitespace-mode-maybe (&rest _)

View file

@ -463,12 +463,8 @@ Accepts the following properties:
(when-let* ((val (plist-get plist prop)))
(plist-put plist prop (eval val))))
`(progn
(when ,(and pkg-pin t)
(cl-pushnew (cons ',name ,pkg-pin) package-pinned-packages
:test #'eq :key #'car))
(when ,(and old-plist t)
(assq-delete-all ',name doom-packages))
(push ',(cons name plist) doom-packages))))
,(if (and pkg-pin t) `(map-put package-pinned-packages ',name ,pkg-pin))
(map-put doom-packages ',name ',plist))))
(defmacro depends-on! (module submodule)
"Declares that this module depends on another.