core: minor refactor/reformat

+ Prefer cl-loop over cl-mapcan for performance reasons.
+ Remove unnecessary let form
+ Log doom-try-run-hook when doom-debug-mode is on.
This commit is contained in:
Henrik Lissner 2018-06-19 20:55:44 +02:00
parent adf9b7d26f
commit 600d7bcb4f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 13 additions and 9 deletions

View file

@ -94,8 +94,9 @@ Example:
(unless (plist-member plist :path)
(plist-put plist :path (or (plist-get old-plist :path)
(doom-module-locate-path category module))))))
(let ((key (cons category module)))
(puthash key plist doom-modules)))
(puthash (cons category module)
plist
doom-modules))
(defun doom-module-path (category module &optional file)
"Like `expand-file-name', but expands FILE relative to CATEGORY (keywordp) and
@ -205,11 +206,10 @@ non-nil, return paths of possible modules, activated or otherwise."
(remove-hook hook #',fn)))
(map-delete doom--deferred-packages-alist ',name)
(fmakunbound ',fn))))
(cl-mapcan (lambda (hook)
(if (functionp hook)
`((advice-add #',hook :before #',fn))
`((add-hook ',hook #',fn))))
hooks)
(cl-loop for hook in hooks
collect (if (functionp hook)
`(advice-add #',hook :before #',fn)
`(add-hook ',hook #',fn)))
`((map-put doom--deferred-packages-alist
',name
'(,@hooks ,@(cdr (assq name doom--deferred-packages-alist)))))