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
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -89,12 +89,58 @@ selection of all minor-modes, active or not."
;;;###autoload
(defun doom/info ()
"Collects information about this session of Doom Emacs and copies it to the
clipboard. Helpful when filing bug reports!"
"Collects some debug information about your Emacs session, and copies it to
your clipboard. Use this when you are filing bug reports!"
(declare (interactive-only t))
(interactive)
(with-temp-buffer
(message "Producing information about your system...")
(call-process (expand-file-name "bin/doom-doctor" doom-emacs-dir) nil t)
(ansi-color-apply-on-region (point-min) (point-max))
(kill-new (buffer-string))
(message "Done. Copied to clipboard!")))
(message "Generating Doom info...")
(let* ((default-directory doom-emacs-dir)
(str (format
(concat "### System Information\n"
"- OS: %s (%s)\n"
"- 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")))