Fix & extend doom/help-packages

+ It would display Doom's commit, rather than the package's
+ Add Homepage link
+ Fix module lists for packages that aren't installed
This commit is contained in:
Henrik Lissner 2020-03-12 12:42:58 -04:00
parent 2fcc338702
commit 2c2df9df8c
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -468,27 +468,44 @@ If prefix arg is present, refresh the cache."
(insert (symbol-name package) "\n") (insert (symbol-name package) "\n")
(package--print-help-section "Source") (package--print-help-section "Source")
(insert (or (pcase (doom-package-backend package) (pcase (doom-package-backend package)
(`straight (`straight
(format! "Straight (%s)\n%s" (insert "Straight\n")
(let ((default-directory (straight--build-dir (symbol-name package)))) (package--print-help-section "Pinned")
(cdr (insert (if-let (pin (plist-get (cdr (assq package doom-packages)) :pin))
(doom-call-process "git" "log" "-1" "--format=%D %h %ci"))) pin
(indent "unpinned")
13 (string-trim "\n")
(pp-to-string (package--print-help-section "Build")
(doom-package-build-recipe package)))))) (insert (let ((default-directory (straight--repos-dir (symbol-name package))))
(`elpa (cdr
(format "[M]ELPA %s" (doom--package-url package))) (doom-call-process "git" "log" "-1" "--format=%D %h %ci")))
(`builtin "Built-in") "\n")
(_ (abbreviate-file-name (symbol-file package)))) (let ((recipe (doom-package-build-recipe package)))
"unknown") (insert (format! "%s\n"
"\n") (indent 13
(string-trim (pp-to-string recipe)))))
(when (gethash (symbol-name package) straight--build-cache) (package--print-help-section "Homepage")
(insert (doom--package-url package))))
(`elpa (insert "[M]ELPA " (doom--package-url package)))
(`builtin (insert "Built-in"))
(`other (insert
(abbreviate-file-name
(or (symbol-file package)
(locate-library (symbol-name package))))))
(_ (insert "Not installed")))
(insert "\n")
(when-let
(modules
(if (gethash (symbol-name package) straight--build-cache)
(doom-package-get package :modules)
(plist-get (cdr (assq package (doom-packages-list 'all)))
:modules)))
(package--print-help-section "Modules") (package--print-help-section "Modules")
(insert "Declared by the following Doom modules:\n") (insert "Declared by the following Doom modules:\n")
(dolist (m (doom-package-get package :modules)) (dolist (m modules)
(insert indent) (insert indent)
(doom--help-package-insert-button (doom--help-package-insert-button
(format "%s %s" (car m) (or (cdr m) "")) (format "%s %s" (car m) (or (cdr m) ""))