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")))
|
(sh "uname -msrv")))
|
||||||
(path . ,(mapcar #'abbreviate-file-name exec-path)))
|
(path . ,(mapcar #'abbreviate-file-name exec-path)))
|
||||||
(config
|
(config
|
||||||
(envfile . ,(cond ((file-exists-p doom-env-file) 'envvar-file)
|
(envfile
|
||||||
((featurep 'exec-path-from-shell) 'exec-path-from-shell)))
|
. ,(cond ((file-exists-p doom-env-file) 'envvar-file)
|
||||||
(elc-files . ,(length (doom-files-in `(,@doom-modules-dirs
|
((featurep 'exec-path-from-shell) 'exec-path-from-shell)))
|
||||||
,doom-core-dir
|
(elc-files
|
||||||
,doom-private-dir)
|
. ,(length (doom-files-in `(,@doom-modules-dirs
|
||||||
:type 'files :match "\\.elc$")))
|
,doom-core-dir
|
||||||
(modules ,@(or (cl-loop with cat = nil
|
,doom-private-dir)
|
||||||
for key being the hash-keys of doom-modules
|
:type 'files :match "\\.elc$")))
|
||||||
if (or (not cat) (not (eq cat (car key))))
|
(modules
|
||||||
do (setq cat (car key))
|
,@(or (cl-loop with cat = nil
|
||||||
and collect cat
|
for key being the hash-keys of doom-modules
|
||||||
and collect (cdr key)
|
if (or (not cat) (not (eq cat (car key))))
|
||||||
else collect
|
do (setq cat (car key))
|
||||||
(let ((flags (doom-module-get cat (cdr key) :flags)))
|
and collect cat
|
||||||
(if flags
|
and collect (cdr key)
|
||||||
`(,(cdr key) ,@flags)
|
else collect
|
||||||
(cdr key))))
|
(let ((flags (doom-module-get cat (cdr key) :flags)))
|
||||||
'("n/a")))
|
(if flags
|
||||||
(packages ,@(or (ignore-errors
|
`(,(cdr key) ,@flags)
|
||||||
(require 'use-package)
|
(cdr key))))
|
||||||
(cl-loop for (name . plist) in (doom-find-packages :private t)
|
'("n/a")))
|
||||||
if (use-package-plist-delete (copy-sequence plist) :modules)
|
(packages
|
||||||
collect (format "%s" (cons name it))
|
,@(or (ignore-errors
|
||||||
else
|
(require 'core-packages)
|
||||||
collect (symbol-name name)))
|
(doom-initialize-packages)
|
||||||
'("n/a"))))))))
|
(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
|
;;; 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)
|
(defun doom--read-module-packages-file (file &optional eval noerror)
|
||||||
(with-temp-buffer ; prevent buffer-local settings from propagating
|
(with-temp-buffer ; prevent buffer-local settings from propagating
|
||||||
(condition-case e
|
(condition-case e
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue