forked from emacs-w3m/emacs-w3m
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
w3m-bug.el
187 lines (169 loc) · 6.29 KB
/
w3m-bug.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
;;; w3m-bug.el --- command to report emacs-w3m bugs -*- lexical-binding: nil -*-
;; Copyright (C) 2002, 2003, 2005, 2007, 2010, 2019, 2022
;; TSUCHIYA Masatoshi <[email protected]>
;; Author: Katsumi Yamaoka <[email protected]>
;; Keywords: w3m, WWW, hypermedia
;; This file is a part of emacs-w3m.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; `M-x report-emacs-w3m-bug' starts an email note to the emacs-w3m
;; developers describing a problem.
;;; Code:
(defvar report-emacs-w3m-bug-address "[email protected]"
"*Address of mailing list for emacs-w3m bugs.")
(defvar report-emacs-w3m-bug-no-explanations nil
"*If non-nil, suppress the explanations given for the sake of novice users.")
(defconst report-emacs-w3m-bug-system-informations
(eval
'`(emacs-w3m-git-revision
emacs-w3m-version
emacs-version
;; The form ,@(if (boundp 'foo) '(foo)) used here is
;; meant to generate nothing if `foo' is not bound.
,@(if (boundp 'mule-version)
'(mule-version))
system-type
(featurep 'gtk)
(featurep 'w3m-load)
w3m-version
w3m-type
w3m-compile-options
w3m-language
w3m-command-arguments
w3m-command-arguments-alist
w3m-command-environment
w3m-input-coding-system
w3m-output-coding-system))
"List of the system informations. Users should NEVER modify the value."
;; For the developers:
;; It is possible that it would be a security hole. To prevent those
;; rogue attacks, this constant should be reloaded for each time to
;; send a bug report. Each element can be the symbol of a variable,
;; a Lisp function with no argument or any Lisp form to be evaluated.
)
;;;###autoload
(defun report-emacs-w3m-bug (topic &optional buffer)
"Report a bug in emacs-w3m.
Prompts for bug subject. Leaves you in a mail buffer."
(interactive
(let* ((buffer (current-buffer))
(buffers (cons buffer (delq buffer (buffer-list))))
keymap)
(save-current-buffer
(while buffers
(setq buffer (car buffers)
buffers (cdr buffers))
(set-buffer buffer)
(save-restriction
(widen)
(if (or (eq major-mode 'w3m-mode)
(and (keymapp (setq keymap
(or (get-text-property
(max (1- (point-max)) (point-min))
'keymap)
(get-text-property
(max (1- (point-max)) (point-min))
'local-map)))))
(where-is-internal 'w3m-print-current-url keymap))
(setq buffers nil)
(setq buffer nil)))))
(list (read-string "Bug Subject: ") buffer)))
(let (after-load-alist)
(load "w3m-load" t t)
;; See the comment for `report-emacs-w3m-bug-system-informations'.
(load "w3m-bug"))
(compose-mail report-emacs-w3m-bug-address topic nil 'new)
(goto-char (point-min))
(re-search-forward (concat "^" (regexp-quote mail-header-separator) "$"))
(forward-line 1)
(unless buffer
(insert
(if (and (boundp 'w3m-language)
(equal (symbol-value 'w3m-language) "Japanese"))
"もし可能なら emacs-w3m を起動してからやり直してください。\n"
"It is if possible, please redo after starting emacs-w3m.\n")
"\
================================================================\n"))
(unless report-emacs-w3m-bug-no-explanations
;; Insert warnings for the novice users.
(if (and (boundp 'w3m-language)
(equal (symbol-value 'w3m-language) "Japanese"))
(progn
(insert "このバグリポートは emacs-w3m 開発チームに送られます。\n")
(put-text-property (point)
(progn
(insert "\
あなたのローカルサイトの管理者宛てではありません!!")
(point))
'face 'underline)
(insert "\n\nできるだけ簡潔に述べてください:
\t- 何が起きましたか?
\t- 本当はどうなるべきだったと思いますか?
\t- そのとき何をしましたか? (正確に)
もし Lisp のバックトレースがあれば添付してください。\n"))
(insert "\
This bug report will be sent to the emacs-w3m development team,\n")
(put-text-property (point)
(progn
(insert " not to your local site managers!!")
(point))
'face 'italic)
(insert "\nPlease write in ")
(put-text-property (point) (progn
(insert "simple")
(point))
'face 'italic)
(insert " English, because the emacs-w3m developers
aren't good at English reading. ;-)
Please describe as succinctly as possible:
\t- What happened.
\t- What you thought should have happened.
\t- Precisely what you were doing at the time.
Please also include any Lisp back-traces that you may have.\n"))
(insert "\
================================================================\n"))
(insert "Dear Bug Team!\n\n")
(let ((user-point (point))
(print-escape-newlines t)
(print-quoted t)
infos print-length print-level)
(insert "\n
================================================================
System Info to help track down your bug:
---------------------------------------\n")
(with-current-buffer (or buffer (current-buffer))
(dolist (info report-emacs-w3m-bug-system-informations)
(push (prin1-to-string info) infos)
(push "\n => " infos)
(push (cond ((functionp info)
(prin1-to-string (condition-case code
(funcall info)
(error
code))))
((symbolp info)
(prin1-to-string (condition-case code
(symbol-value info)
(error
code))))
((consp info)
(prin1-to-string (condition-case code
(eval info)
(error
code)))))
infos)
(push "\n" infos)))
(apply 'insert (nreverse infos))
(goto-char user-point)
(set-buffer-modified-p nil)))
;;; w3m-bug.el ends here