From 1dfe6c472aaa7daef1e7a02860d0af349176731e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 2 Feb 2018 23:44:09 -0500 Subject: [PATCH] Rewrite doom/info for concise debug output --- core/autoload/debug.el | 62 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/core/autoload/debug.el b/core/autoload/debug.el index 9cd01271f..581d21229 100644 --- a/core/autoload/debug.el +++ b/core/autoload/debug.el @@ -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")))