Rewrite doom/info for concise debug output

This commit is contained in:
Henrik Lissner
2018-02-02 23:44:09 -05:00
parent 49a45ec0c8
commit 1dfe6c472a

View File

@ -89,12 +89,58 @@ selection of all minor-modes, active or not."
;;;###autoload ;;;###autoload
(defun doom/info () (defun doom/info ()
"Collects information about this session of Doom Emacs and copies it to the "Collects some debug information about your Emacs session, and copies it to
clipboard. Helpful when filing bug reports!" your clipboard. Use this when you are filing bug reports!"
(declare (interactive-only t))
(interactive) (interactive)
(with-temp-buffer (message "Generating Doom info...")
(message "Producing information about your system...") (let* ((default-directory doom-emacs-dir)
(call-process (expand-file-name "bin/doom-doctor" doom-emacs-dir) nil t) (str (format
(ansi-color-apply-on-region (point-min) (point-max)) (concat "### System Information\n"
(kill-new (buffer-string)) "- OS: %s (%s)\n"
(message "Done. Copied to clipboard!"))) "- Emacs: %s\n"
"- Doom: %s (%s https://github.com/hlissner/doom-emacs/commit/%s)\n"
"- Graphic display: %s (daemon: %s)\n"
"- System features: %s\n"
"- Details:\n ```elisp\n modules:\t%s packages:\t%s compiled files:\t%s exec-path:\t%s ```\n")
system-type
emacs-version (format-time-string "%b %d, %Y" emacs-build-time)
doom-version
(vc-git--symbolic-ref "core/core.el") (vc-git-working-revision "core/core.el")
(display-graphic-p) (daemonp)
(bound-and-true-p system-configuration-features)
;; details
(pp-to-string ; modules
(or (ignore-errors
(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
else collect (cdr key)))
"n/a"))
(pp-to-string ; packages
(or (ignore-errors
(let (packages)
(require 'async)
(async-get
(async-start
`(lambda ()
(setq load-path ',load-path)
(load ,(expand-file-name "core/core.el" doom-emacs-dir))
(load ,(expand-file-name "init.el" doom-emacs-dir))
(load ,(expand-file-name "core/autoload/packages.el" doom-emacs-dir))
(doom-get-packages))
(lambda (p) (setq packages p))))
(cl-sort (mapcar #'car packages) #'string-lessp :key #'symbol-name)))
"n/a"))
(pp-to-string ; compiled files
(or (ignore-errors
(cl-delete-duplicates
(cl-loop for file in (append (reverse (directory-files-recursively doom-core-dir "\\.elc$"))
(reverse (directory-files-recursively doom-modules-dir "\\.elc$")))
collect (file-relative-name (file-name-directory file) doom-emacs-dir))
:test #'equal))
"n/a"))
(pp-to-string exec-path))))
(kill-new str)
(message "Done! Copied to your clipboard")))