Fix private package declaration order issues

The user's private packages.el is read first, to ensure disabled
packages are recorded as soon as possible, however, this means private
packages are recorded early into `doom-packages`, and so are built
first (and thus, before org-mode, which is later registered by the
lang/org module).

This compilation order can cause lots of issues with org packages
loading the older, built-in version of org included with Emacs, instead
of the newer org-mode.

May address #3172
This commit is contained in:
Henrik Lissner 2020-08-18 17:16:06 -04:00
parent 58af4aef56
commit f3740d4766
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -331,6 +331,7 @@ installed."
If ALL-P, gather packages unconditionally across all modules, including disabled If ALL-P, gather packages unconditionally across all modules, including disabled
ones." ones."
(let ((packages-file (concat doom-packages-file ".el")) (let ((packages-file (concat doom-packages-file ".el"))
doom-disabled-packages
doom-packages) doom-packages)
(doom--read-packages (doom--read-packages
(doom-path doom-core-dir packages-file) all-p 'noerror) (doom-path doom-core-dir packages-file) all-p 'noerror)
@ -342,10 +343,12 @@ ones."
(doom-files-in doom-modules-dir (doom-files-in doom-modules-dir
:depth 2 :depth 2
:match "/packages\\.el$")) :match "/packages\\.el$"))
;; We load the private packages file twice to ensure disabled packages ;; We load the private packages file twice to populate
;; are seen ASAP, and a second time to ensure privately overridden ;; `doom-disabled-packages' disabled packages are seen ASAP, and a
;; packages are properly overwritten. ;; second time to ensure privately overridden packages are properly
(doom--read-packages private-packages nil 'noerror) ;; overwritten.
(let (doom-packages)
(doom--read-packages private-packages nil 'noerror))
(cl-loop for key being the hash-keys of doom-modules (cl-loop for key being the hash-keys of doom-modules
for path = (doom-module-path (car key) (cdr key) packages-file) for path = (doom-module-path (car key) (cdr key) packages-file)
for doom--current-module = key for doom--current-module = key
@ -473,9 +476,10 @@ elsewhere."
(signal 'doom-package-error (signal 'doom-package-error
(cons ,(symbol-name name) (cons ,(symbol-name name)
(error-message-string e))))) (error-message-string e)))))
;; This is the only side-effect of this macro! ;; These are the only side-effects of this macro!
(setf (alist-get name doom-packages) plist) (setf (alist-get name doom-packages) plist)
(unless (plist-get plist :disable) (if (plist-get plist :disable)
(add-to-list 'doom-disabled-packages name)
(with-no-warnings (with-no-warnings
(cons name plist))))) (cons name plist)))))