Update & refactor doom-info

This commit is contained in:
Henrik Lissner 2018-06-10 17:16:50 +02:00
parent edb6fd1964
commit 7e00a83acc
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -20,30 +20,32 @@ ready to be pasted in a bug report on github."
"- System features: %s\n" "- System features: %s\n"
"- Details:\n" "- Details:\n"
" ```elisp\n" " ```elisp\n"
" elc count: %s\n"
" uname -a: %s\n" " uname -a: %s\n"
" modules: %s\n" " modules: %s\n"
" packages: %s\n" " packages: %s\n"
" elc dirs: %s\n"
" exec-path: %s\n" " exec-path: %s\n"
" ```") " ```")
system-type system-configuration system-type system-configuration
emacs-version (format-time-string "%b %d, %Y" emacs-build-time) emacs-version (format-time-string "%b %d, %Y" emacs-build-time)
doom-version doom-version
(if-let* ((branch (vc-git--symbolic-ref "core/core.el"))) (or (vc-git--symbolic-ref "core/core.el")
branch
"n/a") "n/a")
(if-let* ((rev (vc-git-working-revision "core/core.el"))) (or (vc-git-working-revision "core/core.el")
rev
"n/a") "n/a")
(display-graphic-p) (daemonp) (display-graphic-p) (daemonp)
(bound-and-true-p system-configuration-features) (bound-and-true-p system-configuration-features)
;; details ;; details
(length (doom-files-in `(,@doom-modules-dirs
,doom-core-dir
,doom-private-dir)
:type 'files :match "\\.elc$"))
(with-temp-buffer (with-temp-buffer
(unless (zerop (call-process "uname" nil t nil "-a")) (unless (zerop (call-process "uname" nil t nil "-a"))
(insert (format "%s" system-type))) (insert (format "%s" system-type)))
(string-trim (buffer-string))) (string-trim (buffer-string)))
(or (cl-loop with cat = nil (or (cl-loop with cat = nil
for key being the hash-keys of doom-modules for key being the hash-keys of (doom-modules)
if (or (not cat) (not (eq cat (car key)))) if (or (not cat) (not (eq cat (car key))))
do (setq cat (car key)) and collect cat do (setq cat (car key)) and collect cat
else collect else collect
@ -52,33 +54,13 @@ ready to be pasted in a bug report on github."
`(,(cdr key) ,@flags) `(,(cdr key) ,@flags)
(cdr key)))) (cdr key))))
"n/a") "n/a")
(or (let (packages)
(ignore-errors
(require 'async)
;; collect these in another session to protect this
;; session's state
(async-get
(async-start
`(lambda ()
(let ((noninteractive t)
(load-path ',load-path)
(package-alist ',package-alist))
(load ,(expand-file-name "init.el" doom-emacs-dir))
(doom-get-packages)))
(lambda (p) (setq packages p))))
(cl-loop for pkg in (cl-sort packages #'string-lessp
:key (lambda (x) (symbol-name (car x))))
collect (if (cdr pkg)
(format "%s" pkg)
(symbol-name (car pkg))))))
"n/a")
(or (ignore-errors (or (ignore-errors
(cl-delete-duplicates (require 'use-package)
(cl-loop for file in (append (reverse (directory-files-recursively doom-core-dir "\\.elc$")) (cl-loop for (pkg . plist) in (doom-get-packages :all t :private t :sort #'string-lessp)
(cl-loop for dir in doom-modules-dirs if (use-package-plist-delete (copy-seq plist) :private)
nconc (directory-files-recursively dir "\\.elc$"))) collect (format "%s" (cons pkg it))
collect (file-relative-name (file-name-directory file) doom-emacs-dir)) else
:test #'equal)) collect (symbol-name pkg)))
"n/a") "n/a")
;; abbreviate $HOME to hide username ;; abbreviate $HOME to hide username
(mapcar #'abbreviate-file-name exec-path)))) (mapcar #'abbreviate-file-name exec-path))))