|
17 | 17 | ;; http://www.gnu.org/licenses/ for details.
|
18 | 18 |
|
19 | 19 | (require 'cl-lib)
|
| 20 | +(require 'package) |
20 | 21 | (require 'racket-util)
|
21 | 22 |
|
22 | 23 | ;;;###autoload
|
23 | 24 | (defun racket-bug-report ()
|
24 | 25 | "Fill a buffer with data to make a racket-mode bug report."
|
25 | 26 | (interactive)
|
26 |
| - (unless (memq major-mode '(racket-mode racket-repl-mode)) |
27 |
| - (user-error "Please run this from a racket-mode or racket-repl-mode buffer.")) |
28 |
| - (with-help-window "*racket-mode bug report*" |
29 |
| - (princ "TIP: If you get an `invalid function' error, be aware that Emacs package\n") |
30 |
| - (princ "updates don't necessarily fully update Emacs' state. In some cases, you\n") |
31 |
| - (princ "might even need to:\n\n") |
32 |
| - (princ " 1. Uninstall racket-mode\n") |
33 |
| - (princ " 2. Exit and restart Emacs\n") |
34 |
| - (princ " 3. Install racket-mode\n\n\n") |
35 |
| - (princ "When you submit a bug report at:\n\n") |
36 |
| - (princ " https://github.com/greghendershott/racket-mode/issues/new\n\n") |
37 |
| - (princ "Please copy and paste ALL OF THE FOLLOWING LINES from\n") |
38 |
| - (princ "`<details>' through `</details>':\n\n\n") |
39 |
| - (princ "<details>\n") |
40 |
| - (princ "```\n") |
41 |
| - (cl-labels ((id-val (id) (list id |
42 |
| - (condition-case () (symbol-value id) |
43 |
| - (error 'UNDEFINED))))) |
44 |
| - (let ((emacs-uptime (emacs-uptime))) |
45 |
| - (pp `(,@(mapcar #'id-val |
46 |
| - `(emacs-version |
47 |
| - emacs-uptime |
48 |
| - system-type |
49 |
| - major-mode |
50 |
| - racket--el-source-dir |
51 |
| - racket--rkt-source-dir |
52 |
| - racket-program |
53 |
| - racket-command-port |
54 |
| - racket-command-timeout |
55 |
| - racket-memory-limit |
56 |
| - racket-error-context |
57 |
| - racket-retry-as-skeleton |
58 |
| - racket-error-context |
59 |
| - racket-history-filter-regexp |
60 |
| - racket-images-inline |
61 |
| - racket-images-keep-last |
62 |
| - racket-use-repl-submit-predicate |
63 |
| - racket-images-system-viewer |
64 |
| - racket-pretty-print |
65 |
| - racket-indent-curly-as-sequence |
66 |
| - racket-indent-sequence-depth |
67 |
| - racket-pretty-lambda |
68 |
| - racket-smart-open-bracket-enable |
69 |
| - racket-module-forms |
70 |
| - racket-logger-config))))) |
71 |
| - ;; Show lists of enabled and disabled minor modes, each sorted by name. |
72 |
| - (let* ((minor-modes (cl-remove-duplicates |
73 |
| - (append minor-mode-list |
74 |
| - (mapcar #'car minor-mode-alist)))) |
75 |
| - (modes/values (mapcar #'id-val minor-modes)) |
76 |
| - (sorted (sort modes/values |
77 |
| - (lambda (a b) |
78 |
| - (string-lessp (format "%s" (car a)) |
79 |
| - (format "%s" (car b))))))) |
80 |
| - (cl-labels ((f (x) (list (car x)))) ;car as a list so pp line-wraps |
81 |
| - (pp `(enabled-minor-modes ,@(mapcar #'f (cl-remove-if-not #'cadr sorted)))) |
82 |
| - (pp `(disabled-minor-modes ,@(mapcar #'f (cl-remove-if #'cadr sorted))))))) |
83 |
| - (princ "```\n") |
84 |
| - (princ "</details>\n"))) |
| 27 | + (let ((help-window-select t)) |
| 28 | + (with-help-window "*racket-mode bug report*" |
| 29 | + (princ "Please copy all of the following lines and paste them into your bug report\n") |
| 30 | + (princ "at <https://github.com/greghendershott/racket-mode/issues/>.\n\n") |
| 31 | + |
| 32 | + (princ "<details>\n") |
| 33 | + (princ "```\n") |
| 34 | + (pp (cons '(alist-get 'racket-mode package-alist) |
| 35 | + (let ((v (assq 'racket-mode package-alist))) |
| 36 | + (and v (cdr v))))) |
| 37 | + (cl-labels ((id-val (id) (list id |
| 38 | + (condition-case () (symbol-value id) |
| 39 | + (error 'UNDEFINED))))) |
| 40 | + (let ((emacs-uptime (emacs-uptime))) |
| 41 | + (pp `(,@(mapcar #'id-val |
| 42 | + `(emacs-version |
| 43 | + emacs-uptime |
| 44 | + system-type |
| 45 | + major-mode |
| 46 | + racket--el-source-dir |
| 47 | + racket--rkt-source-dir |
| 48 | + racket-program |
| 49 | + racket-command-port |
| 50 | + racket-command-timeout |
| 51 | + racket-memory-limit |
| 52 | + racket-error-context |
| 53 | + racket-retry-as-skeleton |
| 54 | + racket-error-context |
| 55 | + racket-history-filter-regexp |
| 56 | + racket-images-inline |
| 57 | + racket-images-keep-last |
| 58 | + racket-use-repl-submit-predicate |
| 59 | + racket-images-system-viewer |
| 60 | + racket-pretty-print |
| 61 | + racket-indent-curly-as-sequence |
| 62 | + racket-indent-sequence-depth |
| 63 | + racket-pretty-lambda |
| 64 | + racket-smart-open-bracket-enable |
| 65 | + racket-module-forms |
| 66 | + racket-logger-config))))) |
| 67 | + ;; Show lists of enabled and disabled minor modes, each sorted by name. |
| 68 | + (let* ((minor-modes (cl-remove-duplicates |
| 69 | + (append minor-mode-list |
| 70 | + (mapcar #'car minor-mode-alist)))) |
| 71 | + (modes/values (mapcar #'id-val minor-modes)) |
| 72 | + (sorted (sort modes/values |
| 73 | + (lambda (a b) |
| 74 | + (string-lessp (format "%s" (car a)) |
| 75 | + (format "%s" (car b))))))) |
| 76 | + (cl-labels ((f (x) (list (car x)))) ;car as a list so pp line-wraps |
| 77 | + (pp `(enabled-minor-modes ,@(mapcar #'f (cl-remove-if-not #'cadr sorted)))) |
| 78 | + (pp `(disabled-minor-modes ,@(mapcar #'f (cl-remove-if #'cadr sorted))))))) |
| 79 | + (princ "```\n") |
| 80 | + (princ "</details>\n")) |
| 81 | + (forward-line 2))) |
85 | 82 |
|
86 | 83 | (provide 'racket-bug-report)
|
87 | 84 |
|
|
0 commit comments