-
-
Notifications
You must be signed in to change notification settings - Fork 93
/
racket-bug-report.el
113 lines (104 loc) · 5.14 KB
/
racket-bug-report.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
;;; racket-bug-report.el -*- lexical-binding: t; -*-
;; Copyright (c) 2013-2023 by Greg Hendershott.
;; Portions Copyright (C) 1985-1986, 1999-2013 Free Software Foundation, Inc.
;; Author: Greg Hendershott
;; URL: https://github.com/greghendershott/racket-mode
;; SPDX-License-Identifier: GPL-3.0-or-later
(require 'cl-macs)
(require 'cus-edit)
(require 'package)
(require 'seq)
(require 'racket-back-end)
(require 'racket-cmd)
(require 'racket-custom)
;;;###autoload
(defun racket-bug-report ()
"Fill a buffer with details for a Racket Mode bug report."
(interactive)
(unless (string-match-p "^racket-" (symbol-name major-mode))
(user-error "Please run from a Racket Mode buffer in which you're having a problem"))
(let ((help-window-select t)
(print-length nil) ;for `pp'
(print-level nil)) ;for `pp'
(cl-flet* ((-section (label thunk)
(princ (format "<h2>%s</h2>\n" label))
(princ "<dl>\n")
(funcall thunk)
(princ "</dl>\n"))
(show (label value)
(princ (format "<dt>%s</dt>" label))
(princ "<dd><pre>")
(pp value)
(princ "</pre></dd>\n"))
(show-vars (syms) (dolist (sym syms)
(ignore-errors (show sym (symbol-value sym)))))
(symbol-less-p (a b) (string-lessp (symbol-name a) (symbol-name b))))
(cl-macrolet ((section (title &rest body)
`(-section ,title (lambda () ,@body))))
(with-help-window "*racket-mode bug report*"
(princ "Please copy all of the following lines and paste them into your bug report\n")
(princ "at <https://github.com/greghendershott/racket-mode/issues/>.\n\n")
(princ "<details>\n")
(section "Package"
(show "metadata"
(let ((v (assq 'racket-mode package-alist)))
(and v (cdr v))))
(show-vars '(package-archives
racket--el-source-dir
racket--rkt-source-dir)))
(section "System values"
(show-vars '(emacs-version
major-mode
system-type
x-gtk-use-system-tooltips))
(show 'display-graphic-p (display-graphic-p)))
(section "Buffer values"
(show-vars '(after-change-functions
before-change-functions
completion-at-point-functions
eldoc-documentation-function
font-lock-defaults
pre-command-hook
post-command-hook
post-self-insert-hook
xref-backend-functions)))
(section "Racket Mode values"
(show 'racket--cmd-open-p (racket--cmd-open-p))
(show-vars
(sort (append (racket--bug-report-customs)
'(racket-mode-hook
racket-hash-lang-mode-hook
racket-hash-lang-module-language-hook
racket-repl-mode-hook
racket-back-end-configurations))
#'symbol-less-p)))
(section "Minor modes"
(let* ((minor-modes (seq-uniq
(append minor-mode-list
(mapcar #'car minor-mode-alist))))
(minor-modes (sort minor-modes #'symbol-less-p))
(enabled (seq-filter (lambda (sym)
(when (ignore-errors (symbol-value sym))
sym))
minor-modes))
(disabled (seq-filter (lambda (sym)
(unless (ignore-errors (symbol-value sym))
sym))
minor-modes)))
(show 'enabled (mapcar #'list enabled)) ;so pp line-breaks
(princ "<details><summary>Disabled minor modes</summary>\n")
(show 'disabled (mapcar #'list disabled))
(princ "</details>\n")))
(princ "</details>\n\nSteps to reproduce: "))))
(forward-line 2)))
(defun racket--bug-report-customs ()
(let ((syms nil))
(cl-labels ((item (v) (pcase v
(`(,sym custom-variable) (push sym syms))
(`(,sym custom-group) (group sym))))
(group (sym) (dolist (v (custom-group-members sym nil))
(item v))))
(group 'racket)
syms)))
(provide 'racket-bug-report)
;;; racket-bug-report.el ends here