Skip to content

Commit 5876720

Browse files
Improve racket-bug-report
Fix bug with enabled vs. disabled minor modes; it was reporting this for the help window buffer, not the original buffer. Add eldoc-documentation-strategy and eldoc-documentation-functions variables. Add more Racket customization groups.
1 parent cc25234 commit 5876720

File tree

1 file changed

+49
-32
lines changed

1 file changed

+49
-32
lines changed

racket-bug-report.el

Lines changed: 49 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,26 @@
2222
(interactive)
2323
(unless (string-match-p "^racket-" (symbol-name major-mode))
2424
(user-error "Please run from a Racket Mode buffer in which you're having a problem"))
25-
(let ((help-window-select t)
25+
(let ((original-buffer (current-buffer))
26+
(help-window-select t)
2627
(print-length nil) ;for `pp'
2728
(print-level nil)) ;for `pp'
2829
(cl-flet* ((-section (label thunk)
29-
(princ (format "<h2>%s</h2>\n" label))
30-
(princ "<dl>\n")
31-
(funcall thunk)
32-
(princ "</dl>\n"))
30+
(princ (format "<h2>%s</h2>\n" label))
31+
(princ "<dl>\n")
32+
(funcall thunk)
33+
(princ "</dl>\n"))
3334
(show (label value)
34-
(princ (format "<dt>%s</dt>" label))
35-
(princ "<dd><pre>")
36-
(pp value)
37-
(princ "</pre></dd>\n"))
38-
(show-vars (syms) (dolist (sym syms)
39-
(ignore-errors (show sym (symbol-value sym)))))
40-
(symbol-less-p (a b) (string-lessp (symbol-name a) (symbol-name b))))
35+
(princ (format "<dt>%s</dt>" label))
36+
(princ "<dd><pre>")
37+
(pp value)
38+
(princ "</pre></dd>\n"))
39+
(show-vars (syms)
40+
(with-current-buffer original-buffer
41+
(dolist (sym syms)
42+
(ignore-errors (show sym (symbol-value sym))))))
43+
(symbol-less-p (a b)
44+
(string-lessp (symbol-name a) (symbol-name b))))
4145
(cl-macrolet ((section (title &rest body)
4246
`(-section ,title (lambda () ,@body))))
4347
(with-help-window "*racket-mode bug report*"
@@ -63,6 +67,8 @@
6367
before-change-functions
6468
completion-at-point-functions
6569
eldoc-documentation-function
70+
eldoc-documentation-strategy
71+
eldoc-documentation-functions
6672
font-lock-defaults
6773
pre-command-hook
6874
post-command-hook
@@ -71,26 +77,31 @@
7177
(section "Racket Mode values"
7278
(show 'racket--cmd-open-p (racket--cmd-open-p))
7379
(show-vars
74-
(sort (append (racket--bug-report-customs)
75-
'(racket-mode-hook
76-
racket-hash-lang-mode-hook
77-
racket-hash-lang-module-language-hook
78-
racket-repl-mode-hook
79-
racket-back-end-configurations))
80-
#'symbol-less-p)))
80+
(sort
81+
(seq-uniq
82+
(append
83+
(racket--bug-report-customs)
84+
'(racket-mode-hook
85+
racket-hash-lang-mode-hook
86+
racket-hash-lang-module-language-hook
87+
racket-repl-mode-hook
88+
racket-back-end-configurations)))
89+
#'symbol-less-p)))
8190
(section "Minor modes"
8291
(let* ((minor-modes (seq-uniq
8392
(append minor-mode-list
8493
(mapcar #'car minor-mode-alist))))
8594
(minor-modes (sort minor-modes #'symbol-less-p))
86-
(enabled (seq-filter (lambda (sym)
87-
(when (ignore-errors (symbol-value sym))
88-
sym))
89-
minor-modes))
90-
(disabled (seq-filter (lambda (sym)
91-
(unless (ignore-errors (symbol-value sym))
92-
sym))
93-
minor-modes)))
95+
(enabled (with-current-buffer original-buffer
96+
(seq-filter (lambda (sym)
97+
(when (ignore-errors (symbol-value sym))
98+
sym))
99+
minor-modes)))
100+
(disabled (with-current-buffer original-buffer
101+
(seq-filter (lambda (sym)
102+
(unless (ignore-errors (symbol-value sym))
103+
sym))
104+
minor-modes))))
94105
(show 'enabled (mapcar #'list enabled)) ;so pp line-breaks
95106
(princ "<details><summary>Disabled minor modes</summary>\n")
96107
(show 'disabled (mapcar #'list disabled))
@@ -100,12 +111,18 @@
100111

101112
(defun racket--bug-report-customs ()
102113
(let ((syms nil))
103-
(cl-labels ((item (v) (pcase v
104-
(`(,sym custom-variable) (push sym syms))
105-
(`(,sym custom-group) (group sym))))
106-
(group (sym) (dolist (v (custom-group-members sym nil))
107-
(item v))))
114+
(cl-labels ((item (v)
115+
(pcase v
116+
(`(,sym custom-variable) (push sym syms))
117+
(`(,sym custom-group) (group sym))))
118+
(group (sym)
119+
(dolist (v (custom-group-members sym nil))
120+
(item v))))
108121
(group 'racket)
122+
(group 'racket-xp)
123+
(group 'racket-repl)
124+
(group 'racket-hash-lang)
125+
(group 'racket-other)
109126
syms)))
110127

111128
(provide 'racket-bug-report)

0 commit comments

Comments
 (0)