Mercurial > emacs
comparison lisp/mail/emacsbug.el @ 18795:3446ea06d63f
(report-emacs-bug-run-tersely): New variable
(report-emacs-bug): Insert warnings for novice usres in *mail* buffer.
Set enable-multibyte-characters to nil.
(report-emacs-bug-hook): Check non-English letters. Confirm about
sending a report to FSF.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Tue, 15 Jul 1997 08:23:58 +0000 |
parents | 9e7f6d074138 |
children | cb22b83e1bf8 |
comparison
equal
deleted
inserted
replaced
18794:631776603b13 | 18795:3446ea06d63f |
---|---|
43 (defvar report-emacs-bug-pretest-address "emacs-pretest-bug@gnu.ai.mit.edu" | 43 (defvar report-emacs-bug-pretest-address "emacs-pretest-bug@gnu.ai.mit.edu" |
44 "Address of mailing list for GNU Emacs pretest bugs.") | 44 "Address of mailing list for GNU Emacs pretest bugs.") |
45 | 45 |
46 (defvar report-emacs-bug-orig-text nil | 46 (defvar report-emacs-bug-orig-text nil |
47 "The automatically-created initial text of bug report.") | 47 "The automatically-created initial text of bug report.") |
48 | |
49 ;;;###autoload | |
50 (defvar report-emacs-bug-run-tersely nil | |
51 "*If non-nil, suppress confirmations for novice users.") | |
48 | 52 |
49 ;;;###autoload | 53 ;;;###autoload |
50 (defun report-emacs-bug (topic &optional recent-keys) | 54 (defun report-emacs-bug (topic &optional recent-keys) |
51 "Report a bug in GNU Emacs. | 55 "Report a bug in GNU Emacs. |
52 Prompts for bug subject. Leaves you in a mail buffer." | 56 Prompts for bug subject. Leaves you in a mail buffer." |
66 topic) | 70 topic) |
67 ;; The rest of this does not execute | 71 ;; The rest of this does not execute |
68 ;; if the user was asked to confirm and said no. | 72 ;; if the user was asked to confirm and said no. |
69 (goto-char (point-min)) | 73 (goto-char (point-min)) |
70 (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n")) | 74 (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n")) |
75 ;; Insert warnings for novice users. | |
76 (insert "This mail is sent to Free Software Foundation, ") | |
77 (let ((pos (point))) | |
78 (insert "NOT TO YOUR SITE MANAGERS!!") | |
79 (put-text-property pos (point) 'face 'highlight)) | |
80 (insert "\nPlease write in ") | |
81 (let ((pos (point))) | |
82 (insert "ENGLISH ONLY") | |
83 (put-text-property pos (point) 'face 'highlight)) | |
84 (insert ", recipients are not yet fully multilingualized.\n\n") | |
85 | |
71 (insert "In " (emacs-version) "\n") | 86 (insert "In " (emacs-version) "\n") |
72 (if (and system-configuration-options | 87 (if (and system-configuration-options |
73 (not (equal system-configuration-options ""))) | 88 (not (equal system-configuration-options ""))) |
74 (insert "configured using `configure " | 89 (insert "configured using `configure " |
75 system-configuration-options "'\n")) | 90 system-configuration-options "'\n")) |
121 and what information to supply so that the bug can be fixed. | 136 and what information to supply so that the bug can be fixed. |
122 Type SPC to scroll through this section and its subsections."))) | 137 Type SPC to scroll through this section and its subsections."))) |
123 ;; Make it less likely people will send empty messages. | 138 ;; Make it less likely people will send empty messages. |
124 (make-local-variable 'mail-send-hook) | 139 (make-local-variable 'mail-send-hook) |
125 (add-hook 'mail-send-hook 'report-emacs-bug-hook) | 140 (add-hook 'mail-send-hook 'report-emacs-bug-hook) |
141 ;; Discourage users to write non-English text. | |
142 (setq enable-multibyte-characters nil) | |
126 (save-excursion | 143 (save-excursion |
127 (goto-char (point-max)) | 144 (goto-char (point-max)) |
128 (skip-chars-backward " \t\n") | 145 (skip-chars-backward " \t\n") |
129 (make-local-variable 'report-emacs-bug-orig-text) | 146 (make-local-variable 'report-emacs-bug-orig-text) |
130 (setq report-emacs-bug-orig-text (buffer-substring (point-min) (point)))) | 147 (setq report-emacs-bug-orig-text (buffer-substring (point-min) (point)))) |
145 (skip-chars-backward " \t\n") | 162 (skip-chars-backward " \t\n") |
146 (if (and (= (- (point) (point-min)) | 163 (if (and (= (- (point) (point-min)) |
147 (length report-emacs-bug-orig-text)) | 164 (length report-emacs-bug-orig-text)) |
148 (equal (buffer-substring (point-min) (point)) | 165 (equal (buffer-substring (point-min) (point)) |
149 report-emacs-bug-orig-text)) | 166 report-emacs-bug-orig-text)) |
150 (error "No text entered in bug report")))) | 167 (error "No text entered in bug report")) |
168 | |
169 ;; Check the buffer contents and reject non-English letters. | |
170 (let ((charsets (delq 'ascii | |
171 (find-charset-region (point-min) (point-max))))) | |
172 (if charsets | |
173 (if (or report-emacs-bug-run-tersely | |
174 (y-or-n-p "Convert Non-English letters to hexadecimal? ")) | |
175 (save-excursion | |
176 (goto-char (point-min)) | |
177 (let ((enable-multibyte-characters nil) | |
178 (pattern (format "[%c-%c]" 128 255)) | |
179 ch) | |
180 (while (re-search-forward pattern nil t) | |
181 (setq ch (preceding-char)) | |
182 (delete-char -1) | |
183 (insert (format "=%02x" ch))))) | |
184 (error "Please delete non-English chars by yourself")))) | |
185 | |
186 ;; The last warning for novice users. | |
187 (if (or report-emacs-bug-run-tersely | |
188 (yes-or-no-p | |
189 "Do you surely send this mail to Free Software Foundation? ")) | |
190 ;; Just send the current mail. | |
191 nil | |
192 (goto-char (point-min)) | |
193 (if (search-forward "To: ") | |
194 (let ((pos (point))) | |
195 (end-of-line) | |
196 (delete-region pos (point)))) | |
197 (kill-local-variable 'mail-send-hook) | |
198 (with-output-to-temp-buffer "*Bug Help*" | |
199 (princ (substitute-command-keys "\ | |
200 You invoked the command report-emacs-bug (\\[report-emacs-bug]), | |
201 but refused to send an e-mail report to Free Software Foundation. | |
202 | |
203 If you want to send the mail to someone else, | |
204 please insert the actual e-mail address after \"To: \", | |
205 and send the mail again by \\[mail-send-and-exit]."))) | |
206 (error "Report-emacs-bug was cancelled, please read *Bug Help* buffer")) | |
207 )) | |
151 | 208 |
152 (provide 'emacsbug) | 209 (provide 'emacsbug) |
153 | 210 |
154 ;;; emacsbug.el ends here | 211 ;;; emacsbug.el ends here |