Refactor doom-info; remove doom-find-packages
The function was overcomplicated and wasn't any more useful than looking directly at doom-packages
This commit is contained in:
parent
e70998228a
commit
486e21ab44
2 changed files with 34 additions and 111 deletions
|
@ -38,32 +38,40 @@ ready to be pasted in a bug report on github."
|
|||
(sh "uname -msrv")))
|
||||
(path . ,(mapcar #'abbreviate-file-name exec-path)))
|
||||
(config
|
||||
(envfile . ,(cond ((file-exists-p doom-env-file) 'envvar-file)
|
||||
((featurep 'exec-path-from-shell) 'exec-path-from-shell)))
|
||||
(elc-files . ,(length (doom-files-in `(,@doom-modules-dirs
|
||||
,doom-core-dir
|
||||
,doom-private-dir)
|
||||
:type 'files :match "\\.elc$")))
|
||||
(modules ,@(or (cl-loop with cat = nil
|
||||
for key being the hash-keys of doom-modules
|
||||
if (or (not cat) (not (eq cat (car key))))
|
||||
do (setq cat (car key))
|
||||
and collect cat
|
||||
and collect (cdr key)
|
||||
else collect
|
||||
(let ((flags (doom-module-get cat (cdr key) :flags)))
|
||||
(if flags
|
||||
`(,(cdr key) ,@flags)
|
||||
(cdr key))))
|
||||
'("n/a")))
|
||||
(packages ,@(or (ignore-errors
|
||||
(require 'use-package)
|
||||
(cl-loop for (name . plist) in (doom-find-packages :private t)
|
||||
if (use-package-plist-delete (copy-sequence plist) :modules)
|
||||
collect (format "%s" (cons name it))
|
||||
else
|
||||
collect (symbol-name name)))
|
||||
'("n/a"))))))))
|
||||
(envfile
|
||||
. ,(cond ((file-exists-p doom-env-file) 'envvar-file)
|
||||
((featurep 'exec-path-from-shell) 'exec-path-from-shell)))
|
||||
(elc-files
|
||||
. ,(length (doom-files-in `(,@doom-modules-dirs
|
||||
,doom-core-dir
|
||||
,doom-private-dir)
|
||||
:type 'files :match "\\.elc$")))
|
||||
(modules
|
||||
,@(or (cl-loop with cat = nil
|
||||
for key being the hash-keys of doom-modules
|
||||
if (or (not cat) (not (eq cat (car key))))
|
||||
do (setq cat (car key))
|
||||
and collect cat
|
||||
and collect (cdr key)
|
||||
else collect
|
||||
(let ((flags (doom-module-get cat (cdr key) :flags)))
|
||||
(if flags
|
||||
`(,(cdr key) ,@flags)
|
||||
(cdr key))))
|
||||
'("n/a")))
|
||||
(packages
|
||||
,@(or (ignore-errors
|
||||
(require 'core-packages)
|
||||
(doom-initialize-packages)
|
||||
(cl-loop for (name . plist) in doom-packages
|
||||
if (doom-package-private-p name)
|
||||
collect
|
||||
(format
|
||||
"%s" (if-let (splist (doom-plist-delete (copy-sequence plist)
|
||||
:modules))
|
||||
(cons name splist)
|
||||
name))))
|
||||
'("n/a"))))))))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -118,91 +118,6 @@ was installed with."
|
|||
;;
|
||||
;;; Package list getters
|
||||
|
||||
;;;###autoload
|
||||
(cl-defun doom-find-packages (&key (installed 'any)
|
||||
(private 'any)
|
||||
(disabled 'any)
|
||||
(pinned 'any)
|
||||
(ignored 'any)
|
||||
(core 'any)
|
||||
_changed
|
||||
backend
|
||||
deps)
|
||||
"Retrieves a list of primary packages (i.e. non-dependencies). Each element is
|
||||
a cons cell, whose car is the package symbol and whose cdr is the quelpa recipe
|
||||
(if any).
|
||||
|
||||
You can build a filtering criteria using one or more of the following
|
||||
properties:
|
||||
|
||||
:backend 'quelpa|'elpa|'emacs|'any
|
||||
Include packages installed through 'quelpa, 'elpa or 'emacs. 'any is the
|
||||
wildcard.
|
||||
:installed BOOL|'any
|
||||
t = only include installed packages
|
||||
nil = exclude installed packages
|
||||
:private BOOL|'any
|
||||
t = only include user-installed packages
|
||||
nil = exclude user-installed packages
|
||||
:core BOOL|'any
|
||||
t = only include Doom core packages
|
||||
nil = exclude Doom core packages
|
||||
:disabled BOOL|'any
|
||||
t = only include disabled packages
|
||||
nil = exclude disabled packages
|
||||
:ignored BOOL|'any
|
||||
t = only include ignored packages
|
||||
nil = exclude ignored packages
|
||||
:pinned BOOL|ARCHIVE
|
||||
Only return packages that are pinned (t), not pinned (nil) or pinned to a
|
||||
specific archive (stringp)
|
||||
:deps BOOL
|
||||
Includes the package's dependencies (t) or not (nil).
|
||||
|
||||
Warning: this function is expensive, as it re-evaluates your all packages.el
|
||||
files."
|
||||
(delete-dups
|
||||
(cl-loop for (sym . plist) in doom-packages
|
||||
if (and (or (not backend)
|
||||
(eq (doom-package-backend sym 'noerror) backend))
|
||||
(or (eq ignored 'any)
|
||||
(let* ((form (plist-get plist :ignore))
|
||||
(value (eval form)))
|
||||
(if ignored value (not value))))
|
||||
(or (eq disabled 'any)
|
||||
(if disabled
|
||||
(plist-get plist :disable)
|
||||
(not (plist-get plist :disable))))
|
||||
(or (eq installed 'any)
|
||||
(if installed
|
||||
(doom-package-installed-p sym)
|
||||
(not (doom-package-installed-p sym))))
|
||||
(or (eq private 'any)
|
||||
(let ((modules (plist-get plist :modules)))
|
||||
(if private
|
||||
(assq :private modules)
|
||||
(not (assq :private modules)))))
|
||||
(or (eq core 'any)
|
||||
(let ((modules (plist-get plist :modules)))
|
||||
(if core
|
||||
(assq :core modules)
|
||||
(not (assq :core modules)))))
|
||||
(or (eq pinned 'any)
|
||||
(cond ((eq pinned 't)
|
||||
(plist-get plist :pin))
|
||||
((null pinned)
|
||||
(not (plist-get plist :pin)))
|
||||
((equal (plist-get plist :pin) pinned)))))
|
||||
collect (cons sym plist)
|
||||
and if (and deps (not (doom-package-built-in-p sym)))
|
||||
nconc
|
||||
(cl-loop for pkg in (doom-package-dependencies sym 'recursive 'noerror)
|
||||
if (or (eq installed 'any)
|
||||
(if installed
|
||||
(doom-package-installed-p pkg)
|
||||
(not (doom-package-installed-p pkg))))
|
||||
collect (cons pkg (cdr (assq pkg doom-packages)))))))
|
||||
|
||||
(defun doom--read-module-packages-file (file &optional eval noerror)
|
||||
(with-temp-buffer ; prevent buffer-local settings from propagating
|
||||
(condition-case e
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue