Redesign doom/info

+ Focus on the important information and cut down on excess.
+ Prompt the user to open pastebin.com after copying doom-info to
  clipboard.
+ Include timestamp in doom-info.
This commit is contained in:
Henrik Lissner 2021-03-07 00:03:04 -05:00
parent 302a76a06e
commit 4192d87dcd

View file

@ -120,21 +120,26 @@ ready to be pasted in a bug report on github."
(regexp-opt (list (user-login-name)) 'words) "$USER"
(abbreviate-file-name path)))
(defun symlink-path (file)
(let ((truefile (file-truename file)))
(format "%s%s" (abbrev-path file)
(if (file-symlink-p file)
(concat " -> " (file-truename file))
""))))
`((system
(info . ,(cons (doom-system-distro-version) (sh "uname" "-msr")))
(if (equal file truefile) ""
(concat " -> " (abbrev-path truefile)))))))
`((generated . ,(format-time-string "%b %d, %Y %H:%M:%S"))
(distro . ,(list (doom-system-distro-version) (sh "uname" "-msr")))
(emacs . ,(delq
nil (list emacs-version
emacs-repository-branch
(substring (or emacs-repository-version "") 0 9)
(symlink-path doom-emacs-dir))))
(doom . ,(list doom-version
(sh "git" "log" "-1" "--format=%D %h %ci")
(symlink-path doom-private-dir)))
(shell . ,(abbrev-path shell-file-name))
(path . ,(mapcar #'abbrev-path exec-path)))
(emacs
(dir . ,(symlink-path doom-emacs-dir))
(version . ,(delq nil (list emacs-version emacs-repository-version (format-time-string "%b %d, %Y" emacs-build-time))))
(buildopts . ,system-configuration-options)
(features . ,system-configuration-features)
(traits
. ,(delq
. ,(mapcar
#'symbol-name
(delq
nil (list (cond ((not doom-interactive-p) 'batch)
((display-graphic-p) 'gui)
('tty))
@ -157,12 +162,6 @@ ready to be pasted in a bug report on github."
,doom-private-dir)
:type 'files :match "\\.elc$")
'byte-compiled-config)))))
(doom
(dir . ,(symlink-path doom-private-dir))
(version . ,(list doom-version (sh "git" "log" "-1" "--format=%D %h %ci")))
,@(when doom-interactive-p
`((font . ,(bound-and-true-p doom-font))
(theme . ,(bound-and-true-p doom-theme))))
(modules
,@(or (cl-loop with cat = nil
for key being the hash-keys of doom-modules
@ -192,15 +191,14 @@ ready to be pasted in a bug report on github."
"package!"))
(error (format "<%S>" e)))
'("n/a")))
(unpin
,@(or (condition-case e
,@(when-let (unpins (condition-case e
(mapcan #'identity
(mapcar
#'cdr (doom--collect-forms-in
(doom-path doom-private-dir "packages.el")
"unpin!")))
(error (format "<%S>" e)))
'("n/a")))
(error (format "<%S>" e))))
(cons 'unpin unpins))
(elpa
,@(or (condition-case e
(progn
@ -208,7 +206,7 @@ ready to be pasted in a bug report on github."
(cl-loop for (name . _) in package-alist
collect (format "%s" name)))
(error (format "<%S>" e)))
'("n/a"))))))))
'("n/a")))))))
;;
@ -246,21 +244,22 @@ copies it to your clipboard, ready to be pasted into bug reports!"
(let ((sexp (prin1-to-string (sexp-at-point))))
(delete-region beg end)
(insert sexp))))))
(insert "```\n")
(dolist (group info)
(insert! "%-8s%-10s %s\n"
((upcase (symbol-name (car group)))
(caadr group)
(cdadr group)))
(dolist (spec (cddr group))
(insert! (indent 8 "%-10s %s\n")
((car spec) (cdr spec)))))
(insert "```\n"))
(dolist (spec info)
(insert! "%11s %s\n"
((car spec)
(if (listp (cdr spec))
(mapconcat (lambda (x) (format "%s" x))
(cdr spec) " ")
(cdr spec))))))
(if (not doom-interactive-p)
(print! (buffer-string))
(pop-to-buffer buffer)
(with-current-buffer (pop-to-buffer buffer)
(setq buffer-read-only t)
(goto-char (point-min))
(kill-new (buffer-string))
(print! (green "Copied your doom info to clipboard"))))))
(when (y-or-n-p "Your doom-info was copied to the clipboard.\n\nOpen pastebin.com?")
(browse-url "https://pastebin.com")))))))
;;;###autoload
(defun doom/am-i-secure ()