Rewrite vanilla sandbox & report-bug commands
- Renamed doom/open-vanilla-sandbox to doom/sandbox (because it's not just for vanilla testing anymore) - Renamed doom/open-bug-report to doom/report-bug (for consistency with `report-emacs-bug`; makes it easier to discover) - Add SPC h d b for doom/report-bug - Add SPC h d s for doom/sandbox
This commit is contained in:
parent
fa7f7042b0
commit
40f6a2b6e3
3 changed files with 47 additions and 61 deletions
|
@ -1,5 +1,8 @@
|
||||||
;;; core/autoload/debug.el -*- lexical-binding: t; -*-
|
;;; core/autoload/debug.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Helpers
|
||||||
|
|
||||||
(defun doom-template-insert (template)
|
(defun doom-template-insert (template)
|
||||||
"TODO"
|
"TODO"
|
||||||
(let ((file (expand-file-name (format "templates/%s" template) doom-core-dir)))
|
(let ((file (expand-file-name (format "templates/%s" template) doom-core-dir)))
|
||||||
|
@ -73,7 +76,21 @@ ready to be pasted in a bug report on github."
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Commands
|
;;; Commands
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun doom/version ()
|
||||||
|
"Display the current version of Doom & Emacs, including the current Doom
|
||||||
|
branch and commit."
|
||||||
|
(interactive)
|
||||||
|
(require 'vc-git)
|
||||||
|
(print! "Doom v%s (Emacs v%s)\nBranch: %s\nCommit: %s"
|
||||||
|
doom-version
|
||||||
|
emacs-version
|
||||||
|
(or (vc-git--symbolic-ref doom-core-dir)
|
||||||
|
"n/a")
|
||||||
|
(or (vc-git-working-revision doom-core-dir)
|
||||||
|
"n/a")))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/info ()
|
(defun doom/info ()
|
||||||
|
@ -110,37 +127,11 @@ markdown and copies it to your clipboard, ready to be pasted into bug reports!"
|
||||||
(message "Your trust roots are set up properly.\n\n%s" (pp-to-string status))
|
(message "Your trust roots are set up properly.\n\n%s" (pp-to-string status))
|
||||||
t)))))
|
t)))))
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun doom/version ()
|
|
||||||
"Display the current version of Doom & Emacs, including the current Doom
|
|
||||||
branch and commit."
|
|
||||||
(interactive)
|
|
||||||
(require 'vc-git)
|
|
||||||
(print! "Doom v%s (Emacs v%s)\nBranch: %s\nCommit: %s"
|
|
||||||
doom-version
|
|
||||||
emacs-version
|
|
||||||
(or (vc-git--symbolic-ref doom-core-dir)
|
|
||||||
"n/a")
|
|
||||||
(or (vc-git-working-revision doom-core-dir)
|
|
||||||
"n/a")))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun doom/copy-backtrace ()
|
|
||||||
"Copy the contents of the *Backtrace* window into your clipboard for easy
|
|
||||||
pasting into a bug report or discord."
|
|
||||||
(interactive)
|
|
||||||
(if-let* ((buf (get-buffer "*Backtrace*")))
|
|
||||||
(with-current-buffer buf
|
|
||||||
(kill-new
|
|
||||||
(string-trim (buffer-string))))
|
|
||||||
(user-error "No backtrace buffer detected")))
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
;;; Vanilla sandbox
|
;;; Vanilla sandbox
|
||||||
|
|
||||||
(defvar doom--sandbox-init-doom-p nil)
|
(defun doom--run-sandbox (&optional mode)
|
||||||
|
|
||||||
(defun doom--run-vanilla-sandbox (&optional mode)
|
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((contents (buffer-string))
|
(let ((contents (buffer-string))
|
||||||
(file (make-temp-file "doom-sandbox-")))
|
(file (make-temp-file "doom-sandbox-")))
|
||||||
|
@ -188,10 +179,10 @@ pasting into a bug report or discord."
|
||||||
(delete-file file)
|
(delete-file file)
|
||||||
(signal (car e) (cdr e)))))))
|
(signal (car e) (cdr e)))))))
|
||||||
|
|
||||||
(fset 'doom--run-vanilla-emacs (lambda! (doom--run-vanilla-sandbox 'vanilla)))
|
(fset 'doom--run-vanilla-emacs (lambda! (doom--run-sandbox 'vanilla)))
|
||||||
(fset 'doom--run-vanilla-doom (lambda! (doom--run-vanilla-sandbox 'vanilla-doom)))
|
(fset 'doom--run-vanilla-doom (lambda! (doom--run-sandbox 'vanilla-doom)))
|
||||||
(fset 'doom--run-vanilla-doom+ (lambda! (doom--run-vanilla-sandbox 'vanilla-doom+)))
|
(fset 'doom--run-vanilla-doom+ (lambda! (doom--run-sandbox 'vanilla-doom+)))
|
||||||
(fset 'doom--run-full-doom (lambda! (doom--run-vanilla-sandbox 'doom)))
|
(fset 'doom--run-full-doom (lambda! (doom--run-sandbox 'doom)))
|
||||||
|
|
||||||
(defvar doom-sandbox-emacs-lisp-mode-map
|
(defvar doom-sandbox-emacs-lisp-mode-map
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
|
@ -206,34 +197,25 @@ pasting into a bug report or discord."
|
||||||
"TODO")
|
"TODO")
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/open-vanilla-sandbox ()
|
(defun doom/sandbox ()
|
||||||
"Open the Emacs Lisp sandbox.
|
"Open the Emacs Lisp sandbox.
|
||||||
|
|
||||||
This is a test bed for running Emacs Lisp in an instance of Emacs with varying
|
This is a test bed for running Emacs Lisp in another instance of Emacs with
|
||||||
amounts of Doom loaded, including:
|
varying amounts of Doom loaded, including:
|
||||||
|
|
||||||
a) vanilla Emacs (nothing loaded),
|
a) vanilla Emacs (nothing loaded),
|
||||||
b) vanilla Doom (only Doom core) and
|
b) vanilla Doom (only Doom core),
|
||||||
c) Doom + modules - your private config.
|
c) Doom + modules - your private config or
|
||||||
|
c) Doom + modules + your private config (a complete Doom session)
|
||||||
|
|
||||||
This is done without sacrificing access to installed packages. Use the sandbox
|
This is done without sacrificing access to installed packages. Use the sandbox
|
||||||
to reproduce bugs and determine if Doom is to blame."
|
to reproduce bugs and determine if Doom is to blame."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((buffer-name "*doom:vanilla-sandbox*")
|
(let* ((buffer-name "*doom:sandbox*")
|
||||||
(exists (get-buffer buffer-name))
|
(exists (get-buffer buffer-name))
|
||||||
(buf (get-buffer-create buffer-name)))
|
(buf (get-buffer-create buffer-name)))
|
||||||
(with-current-buffer buf
|
(with-current-buffer buf
|
||||||
(doom-sandbox-emacs-lisp-mode)
|
(doom-sandbox-emacs-lisp-mode)
|
||||||
(setq header-line-format
|
|
||||||
(concat "C-c C-c = vanilla Emacs"
|
|
||||||
" / "
|
|
||||||
"C-c C-d = Doom core"
|
|
||||||
" / "
|
|
||||||
"C-c C-p = Doom core + modules - private config"
|
|
||||||
" / "
|
|
||||||
"C-c C-f = Full Doom"
|
|
||||||
" / "
|
|
||||||
"C-c C-k to abort"))
|
|
||||||
(setq-local default-directory doom-emacs-dir)
|
(setq-local default-directory doom-emacs-dir)
|
||||||
(unless (buffer-live-p exists)
|
(unless (buffer-live-p exists)
|
||||||
(doom-template-insert "VANILLA_SANDBOX")
|
(doom-template-insert "VANILLA_SANDBOX")
|
||||||
|
@ -244,9 +226,10 @@ to reproduce bugs and determine if Doom is to blame."
|
||||||
(pop-to-buffer buf)))
|
(pop-to-buffer buf)))
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
;;; Reporting bugs
|
;;; Reporting bugs
|
||||||
|
|
||||||
(defun doom--open-bug-report ()
|
(defun doom--report-bug ()
|
||||||
"TODO"
|
"TODO"
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((url "https://github.com/hlissner/doom-emacs/issues/new?body="))
|
(let ((url "https://github.com/hlissner/doom-emacs/issues/new?body="))
|
||||||
|
@ -275,7 +258,7 @@ to reproduce bugs and determine if Doom is to blame."
|
||||||
(error (signal (car e) (car e)))))))
|
(error (signal (car e) (car e)))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/open-bug-report ()
|
(defun doom/report-bug ()
|
||||||
"Open a markdown buffer destinated to populate the New Issue page on Doom
|
"Open a markdown buffer destinated to populate the New Issue page on Doom
|
||||||
Emacs' issue tracker.
|
Emacs' issue tracker.
|
||||||
|
|
||||||
|
@ -290,7 +273,7 @@ will be automatically appended to the result."
|
||||||
(buffer-substring-no-properties
|
(buffer-substring-no-properties
|
||||||
(point-min)
|
(point-min)
|
||||||
(min (point-max) 1000))))))
|
(min (point-max) 1000))))))
|
||||||
(buf (get-buffer-create "*doom:vanilla-sandbox*")))
|
(buf (get-buffer-create "*doom:sandbox*")))
|
||||||
(with-current-buffer buf
|
(with-current-buffer buf
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
(condition-case _ (gfm-mode)
|
(condition-case _ (gfm-mode)
|
||||||
|
@ -305,7 +288,7 @@ will be automatically appended to the result."
|
||||||
(format "\n<details>\n<summary>Backtrace</summary>\n\n```\n%s\n```\n</details>\n"
|
(format "\n<details>\n<summary>Backtrace</summary>\n\n```\n%s\n```\n</details>\n"
|
||||||
backtrace)
|
backtrace)
|
||||||
"")))
|
"")))
|
||||||
(local-set-key (kbd "C-c C-c") #'doom--open-bug-report)
|
(local-set-key (kbd "C-c C-c") #'doom--report-bug)
|
||||||
(local-set-key (kbd "C-c C-k") #'kill-this-buffer)
|
(local-set-key (kbd "C-c C-k") #'kill-this-buffer)
|
||||||
(setq header-line-format "C-c C-c to submit / C-c C-k to close")
|
(setq header-line-format "C-c C-c to submit / C-c C-k to close")
|
||||||
;;
|
;;
|
||||||
|
@ -314,6 +297,7 @@ will be automatically appended to the result."
|
||||||
(pop-to-buffer buf))))
|
(pop-to-buffer buf))))
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
;;; Profiling
|
;;; Profiling
|
||||||
|
|
||||||
(defvar doom--profiler nil)
|
(defvar doom--profiler nil)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
;; Welcome to the vanilla sandbox!
|
;; Welcome to the sandbox!
|
||||||
;;
|
;;
|
||||||
;; This is a test bed for running Emacs Lisp in an instance of Emacs with varying
|
;; This is a test bed for running Emacs Lisp in another instance of Emacs that
|
||||||
;; amounts of Doom loaded:
|
;; has varying amounts of Doom loaded:
|
||||||
;;
|
;;
|
||||||
;; a) vanilla Emacs (nothing loaded) \\[doom--run-vanilla-emacs]
|
;; - vanilla Emacs (nothing loaded) \[doom--run-vanilla-emacs]
|
||||||
;; b) vanilla Doom (only Doom core) \\[doom--run-vanilla-doom]
|
;; - vanilla Doom (only Doom core) \[doom--run-vanilla-doom]
|
||||||
;; c) Doom + modules - your private config \\[doom--run-vanilla-doom+]
|
;; - Doom + modules - your private config \[doom--run-vanilla-doom+]
|
||||||
;; d) Doom (normal) \\[doom--run-full-doom]
|
;; - Doom + modules + your private config \[doom--run-full-doom]
|
||||||
;;
|
;;
|
||||||
;; This is done without sacrificing access to installed packages. Use the sandbox
|
;; This is done without sacrificing access to installed packages. Use the sandbox
|
||||||
;; to reproduce bugs and determine if Doom is to blame.
|
;; to reproduce bugs and determine if Doom is to blame.
|
||||||
|
|
|
@ -185,7 +185,7 @@
|
||||||
"'" #'describe-char
|
"'" #'describe-char
|
||||||
"B" #'doom/open-bug-report
|
"B" #'doom/open-bug-report
|
||||||
"D" #'doom/help
|
"D" #'doom/help
|
||||||
"E" #'doom/open-vanilla-sandbox
|
"E" #'doom/sandbox
|
||||||
"M" #'doom/describe-active-minor-mode
|
"M" #'doom/describe-active-minor-mode
|
||||||
"O" #'+lookup/online
|
"O" #'+lookup/online
|
||||||
"T" #'doom/toggle-profiler
|
"T" #'doom/toggle-profiler
|
||||||
|
@ -212,6 +212,7 @@
|
||||||
"d" nil
|
"d" nil
|
||||||
"d/" #'doom/help-search
|
"d/" #'doom/help-search
|
||||||
"da" #'doom/help-autodefs
|
"da" #'doom/help-autodefs
|
||||||
|
"db" #'doom/report-bug
|
||||||
"dd" #'doom/toggle-debug-mode
|
"dd" #'doom/toggle-debug-mode
|
||||||
"df" #'doom/help-faq
|
"df" #'doom/help-faq
|
||||||
"dh" #'doom/help
|
"dh" #'doom/help
|
||||||
|
@ -219,6 +220,7 @@
|
||||||
"dn" #'doom/help-news
|
"dn" #'doom/help-news
|
||||||
"dp" #'doom/help-packages
|
"dp" #'doom/help-packages
|
||||||
"dc" #'doom/help-package-config
|
"dc" #'doom/help-package-config
|
||||||
|
"ds" #'doom/sandbox
|
||||||
"dt" #'doom/toggle-profiler
|
"dt" #'doom/toggle-profiler
|
||||||
"dv" #'doom/version
|
"dv" #'doom/version
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue