Fix doom/help-packages

This commit is contained in:
Henrik Lissner 2019-09-03 16:53:41 -04:00
parent 92c839be02
commit 44ef61a7f7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -366,15 +366,6 @@ current file is in, or d) the module associated with the current major mode (see
(recenter)
(message "Couldn't find the config block"))))))))
(defvar doom--help-packages-list nil)
(defun doom--help-packages-list (&optional refresh)
(or (unless refresh
doom--help-packages-list)
(setq doom--help-packages-list
(append (cl-loop for package in doom-core-packages
collect (list package :modules '((:core internal))))
(doom-package-list 'all)))))
(defun doom--help-package-configs (package)
;; TODO Add git checks, in case ~/.emacs.d isn't a git repo
(let ((default-directory doom-emacs-dir))
@ -394,16 +385,16 @@ defined and configured.
If prefix arg is present, refresh the cache."
(interactive
(let* ((guess (or (function-called-at-point)
(let ((guess (or (function-called-at-point)
(symbol-at-point))))
(require 'finder-inf nil t)
(require 'package)
(unless package--initialized
(package-initialize t))
(let ((packages (cl-delete-duplicates
(append (mapcar 'car package-alist)
(mapcar 'car package--builtins)
(mapcar 'car (doom--help-packages-list))
(require 'core-packages)
(doom-initialize-packages)
(let ((packages (delete-dups
(append (mapcar #'car package-alist)
(mapcar #'car package--builtins)
(mapcar #'intern (hash-table-keys straight--build-cache))
(mapcar #'car (doom-package-list 'all))
nil))))
(unless (memq guess packages)
(setq guess nil))
@ -415,6 +406,9 @@ If prefix arg is present, refresh the cache."
"Describe package: ")
packages nil t nil nil
(if guess (symbol-name guess))))))))
(require 'core-packages)
(doom-initialize-packages)
(let ((straight-packages (mapcar #'intern (hash-table-keys straight--build-cache))))
(if (or (package-desc-p package)
(and (symbolp package)
(or (assq package package-alist)
@ -425,8 +419,7 @@ If prefix arg is present, refresh the cache."
(with-help-window (help-buffer)))
(save-excursion
(with-current-buffer (help-buffer)
(let ((doom-packages (doom--help-packages-list))
(inhibit-read-only t)
(let ((inhibit-read-only t)
(indent (make-string 13 ? )))
(goto-char (point-max))
(if (re-search-forward "^ *Status: " nil t)
@ -441,7 +434,10 @@ If prefix arg is present, refresh the cache."
(package--print-help-section "Source")
(insert (or (pcase (doom-package-backend package)
(`straight
(format! "Straight\n%s"
(format! "Straight (%s)\n%s"
(let ((default-directory (straight--build-dir (symbol-name package))))
(string-trim
(shell-command-to-string "git log -1 --format=\"%D %h %ci\"")))
(indent
13 (string-trim
(pp-to-string
@ -453,7 +449,7 @@ If prefix arg is present, refresh the cache."
"unknown")
"\n")
(when (assq package doom-packages)
(when (gethash (symbol-name package) straight--build-cache)
(package--print-help-section "Modules")
(insert "Declared by the following Doom modules:\n")
(dolist (m (doom-package-get package :modules))
@ -483,7 +479,7 @@ If prefix arg is present, refresh the cache."
(forward-line (1- line))
(recenter)))))
(insert "\n\n")))))
(insert "\n\n"))))))
(defvar doom--package-cache nil)
(defun doom--package-list ()