aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1997-07-15 08:23:58 +0000
committerKenichi Handa1997-07-15 08:23:58 +0000
commitfe1d8b33cbeadad8cd9c186553ecf87b8bbf314d (patch)
treef86335f0aecc8664db8e85cb52dee56d352e111e
parent8881c1abb94774604aa82aac81ab796639cbdbcd (diff)
downloademacs-fe1d8b33cbeadad8cd9c186553ecf87b8bbf314d.tar.gz
emacs-fe1d8b33cbeadad8cd9c186553ecf87b8bbf314d.zip
(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.
-rw-r--r--lisp/mail/emacsbug.el59
1 files changed, 58 insertions, 1 deletions
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index b2497478d02..774ca1b86bb 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -47,6 +47,10 @@
47 "The automatically-created initial text of bug report.") 47 "The automatically-created initial text of bug report.")
48 48
49;;;###autoload 49;;;###autoload
50(defvar report-emacs-bug-run-tersely nil
51 "*If non-nil, suppress confirmations for novice users.")
52
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.
52Prompts for bug subject. Leaves you in a mail buffer." 56Prompts for bug subject. Leaves you in a mail buffer."
@@ -68,6 +72,17 @@ Prompts for bug subject. Leaves you in a mail buffer."
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 "")))
@@ -123,6 +138,8 @@ 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")
@@ -147,7 +164,47 @@ Type SPC to scroll through this section and its subsections.")))
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 "\
200You invoked the command report-emacs-bug (\\[report-emacs-bug]),
201but refused to send an e-mail report to Free Software Foundation.
202
203If you want to send the mail to someone else,
204please insert the actual e-mail address after \"To: \",
205and 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