aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2009-12-11 01:21:35 +0000
committerGlenn Morris2009-12-11 01:21:35 +0000
commit850948552d2fd4ffbcd49b886c2dd6ef9135817c (patch)
tree6e24f5ee8c372a62aec73e99f278eee488ee0e2f
parentfe03f49a4aed4076ab3d49c84dccba60866e4dba (diff)
downloademacs-850948552d2fd4ffbcd49b886c2dd6ef9135817c.tar.gz
emacs-850948552d2fd4ffbcd49b886c2dd6ef9135817c.zip
No longer require sendmail.
Replace sendmail's `mail-text' by `rfc822-goto-eoh'. (Bug#5174) (report-emacs-bug-orig-text): Doc fix. (report-emacs-bug-send-command, report-emacs-bug-send-hook): New local variables, to adapt to different mail-user-agents. (report-emacs-bug): Fix test for a gnu.org address. Use overlays for emphasis, since font-lock defeats 'face property. Pretest bugs also end up at the newsgroup these days. Stop message-mode stripping text properties. Set and use the new buffer-local variables. (report-emacs-bug-hook): Add doc-string. Remove some unnecessary save-excursions and simplify. Use the appropriate hook and send-command.
-rw-r--r--lisp/ChangeLog14
-rw-r--r--lisp/mail/emacsbug.el136
2 files changed, 92 insertions, 58 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6885f859c03..b16f2bd6211 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,19 @@
12009-12-11 Glenn Morris <rgm@gnu.org> 12009-12-11 Glenn Morris <rgm@gnu.org>
2 2
3 * mail/emacsbug.el: No longer require sendmail.
4 Replace sendmail's `mail-text' by `rfc822-goto-eoh'. (Bug#5174)
5 (report-emacs-bug-orig-text): Doc fix.
6 (report-emacs-bug-send-command, report-emacs-bug-send-hook):
7 New local variables, to adapt to different mail-user-agents.
8 (report-emacs-bug): Fix test for a gnu.org address.
9 Use overlays for emphasis, since font-lock defeats 'face property.
10 Pretest bugs also end up at the newsgroup these days.
11 Stop message-mode stripping text properties.
12 Set and use the new buffer-local variables.
13 (report-emacs-bug-hook): Add doc-string.
14 Remove some unnecessary save-excursions and simplify.
15 Use the appropriate hook and send-command.
16
3 * emacs-lisp/lisp-mode.el (emacs-lisp-mode-map): Standardize the 17 * emacs-lisp/lisp-mode.el (emacs-lisp-mode-map): Standardize the
4 capitalization of some menu entries. 18 capitalization of some menu entries.
5 19
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index da82e553592..2ecca76b5f9 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -31,8 +31,6 @@
31 31
32;;; Code: 32;;; Code:
33 33
34(require 'sendmail)
35
36(defgroup emacsbug nil 34(defgroup emacsbug nil
37 "Sending Emacs bug reports." 35 "Sending Emacs bug reports."
38 :group 'maint 36 :group 'maint
@@ -62,7 +60,15 @@
62 60
63 61
64(defvar report-emacs-bug-orig-text nil 62(defvar report-emacs-bug-orig-text nil
65 "The automatically-created initial text of bug report.") 63 "The automatically-created initial text of the bug report.")
64
65(defvar report-emacs-bug-send-command nil
66 "Name of the command to send the bug report, as a string.")
67(make-variable-buffer-local 'report-emacs-bug-send-command)
68
69(defvar report-emacs-bug-send-hook nil
70 "Hook run before sending the bug report.")
71(make-variable-buffer-local 'report-emacs-bug-send-hook)
66 72
67(declare-function x-server-vendor "xfns.c" (&optional terminal)) 73(declare-function x-server-vendor "xfns.c" (&optional terminal))
68(declare-function x-server-version "xfns.c" (&optional terminal)) 74(declare-function x-server-version "xfns.c" (&optional terminal))
@@ -91,6 +97,7 @@ Prompts for bug subject. Leaves you in a mail buffer."
91 report-emacs-bug-pretest-address 97 report-emacs-bug-pretest-address
92 report-emacs-bug-address)) 98 report-emacs-bug-address))
93 ;; Put these properties on semantically-void text. 99 ;; Put these properties on semantically-void text.
100 ;; report-emacs-bug-hook deletes these regions before sending.
94 (prompt-properties '(field emacsbug-prompt 101 (prompt-properties '(field emacsbug-prompt
95 intangible but-helpful 102 intangible but-helpful
96 rear-nonsticky t)) 103 rear-nonsticky t))
@@ -98,8 +105,7 @@ Prompts for bug subject. Leaves you in a mail buffer."
98 (setq message-end-point 105 (setq message-end-point
99 (with-current-buffer (get-buffer-create "*Messages*") 106 (with-current-buffer (get-buffer-create "*Messages*")
100 (point-max-marker))) 107 (point-max-marker)))
101 (compose-mail reporting-address 108 (compose-mail reporting-address topic)
102 topic)
103 ;; The rest of this does not execute 109 ;; The rest of this does not execute
104 ;; if the user was asked to confirm and said no. 110 ;; if the user was asked to confirm and said no.
105 (rfc822-goto-eoh) 111 (rfc822-goto-eoh)
@@ -111,29 +117,34 @@ Prompts for bug subject. Leaves you in a mail buffer."
111 (backward-char (length signature))) 117 (backward-char (length signature)))
112 (unless report-emacs-bug-no-explanations 118 (unless report-emacs-bug-no-explanations
113 ;; Insert warnings for novice users. 119 ;; Insert warnings for novice users.
114 (when (string-match "@gnu\\.org^" reporting-address) 120 (when (string-match "@gnu\\.org$" reporting-address)
115 (insert "This bug report will be sent to the Free Software Foundation,\n") 121 (insert "This bug report will be sent to the Free Software Foundation,\n")
116 (let ((pos (point))) 122 (let ((pos (point)))
117 (insert "not to your local site managers!") 123 (insert "not to your local site managers!")
118 (put-text-property pos (point) 'face 'highlight))) 124 (overlay-put (make-overlay pos (point)) 'face 'highlight)))
119 (insert "\nPlease write in ") 125 (insert "\nPlease write in ")
120 (let ((pos (point))) 126 (let ((pos (point)))
121 (insert "English") 127 (insert "English")
122 (put-text-property pos (point) 'face 'highlight)) 128 (overlay-put (make-overlay pos (point)) 'face 'highlight))
123 (insert " if possible, because the Emacs maintainers 129 (insert " if possible, because the Emacs maintainers
124usually do not have translators to read other languages for them.\n\n") 130usually do not have translators to read other languages for them.\n\n")
125 (insert (format "Your bug report will be posted to the %s mailing list" 131 (insert (format "Your bug report will be posted to the %s mailing list"
126 reporting-address)) 132 reporting-address))
127 (if pretest-p 133 ;; Nowadays all bug reports end up there.
128 (insert ".\n\n") 134;;; (if pretest-p (insert ".\n\n")
129 (insert ",\nand to the gnu.emacs.bug news group.\n\n"))) 135 (insert ",\nand to the gnu.emacs.bug news group.\n\n"))
130 136
131 (insert "Please describe exactly what actions triggered the bug\n" 137 (insert "Please describe exactly what actions triggered the bug\n"
132 "and the precise symptoms of the bug. If you can, give\n" 138 "and the precise symptoms of the bug. If you can, give\n"
133 "a recipe starting from `emacs -Q':\n\n") 139 "a recipe starting from `emacs -Q':\n\n")
134 (add-text-properties (point) (save-excursion (mail-text) (point)) 140 ;; Stop message-mode stealing the properties we are about to add.
141 (if (boundp 'message-strip-special-text-properties)
142 (set (make-local-variable 'message-strip-special-text-properties) nil))
143 (add-text-properties (save-excursion
144 (rfc822-goto-eoh)
145 (line-beginning-position 2))
146 (point)
135 prompt-properties) 147 prompt-properties)
136
137 (setq user-point (point)) 148 (setq user-point (point))
138 (insert "\n\n") 149 (insert "\n\n")
139 150
@@ -223,20 +234,23 @@ usually do not have translators to read other languages for them.\n\n")
223 ;; This is so the user has to type something in order to send easily. 234 ;; This is so the user has to type something in order to send easily.
224 (use-local-map (nconc (make-sparse-keymap) (current-local-map))) 235 (use-local-map (nconc (make-sparse-keymap) (current-local-map)))
225 (define-key (current-local-map) "\C-c\C-i" 'report-emacs-bug-info) 236 (define-key (current-local-map) "\C-c\C-i" 'report-emacs-bug-info)
237 ;; Could test major-mode instead.
238 (cond ((memq mail-user-agent '(message-user-agent gnus-user-agent))
239 (setq report-emacs-bug-send-command "message-send-and-exit"
240 report-emacs-bug-send-hook 'message-send-hook))
241 ((eq mail-user-agent 'sendmail-user-agent)
242 (setq report-emacs-bug-send-command "mail-send-and-exit"
243 report-emacs-bug-send-hook 'mail-send-hook))
244 ((eq mail-user-agent 'mh-e-user-agent)
245 (setq report-emacs-bug-send-command "mh-send-letter"
246 report-emacs-bug-send-hook 'mh-before-send-letter-hook)))
226 (unless report-emacs-bug-no-explanations 247 (unless report-emacs-bug-no-explanations
227 (with-output-to-temp-buffer "*Bug Help*" 248 (with-output-to-temp-buffer "*Bug Help*"
228 (princ "While in the mail buffer:\n\n") 249 (princ "While in the mail buffer:\n\n")
229 (let ((send 250 (if report-emacs-bug-send-command
230 (cond ((eq mail-user-agent 'sendmail-user-agent)
231 "mail-send-and-exit")
232 ((memq mail-user-agent '(message-user-agent
233 gnus-user-agent))
234 "message-send-and-exit")
235 ((eq mail-user-agent 'mh-e-user-agent)
236 "mh-send-letter"))))
237 (when send
238 (princ (substitute-command-keys 251 (princ (substitute-command-keys
239 (format " Type \\[%s] to send the bug report.\n" send))))) 252 (format " Type \\[%s] to send the bug report.\n"
253 report-emacs-bug-send-command))))
240 (princ (substitute-command-keys 254 (princ (substitute-command-keys
241 " Type \\[kill-buffer] RET to cancel (don't send it).\n")) 255 " Type \\[kill-buffer] RET to cancel (don't send it).\n"))
242 (terpri) 256 (terpri)
@@ -246,13 +260,14 @@ usually do not have translators to read other languages for them.\n\n")
246 information you should include to help fix the bug."))) 260 information you should include to help fix the bug.")))
247 (shrink-window-if-larger-than-buffer (get-buffer-window "*Bug Help*"))) 261 (shrink-window-if-larger-than-buffer (get-buffer-window "*Bug Help*")))
248 ;; Make it less likely people will send empty messages. 262 ;; Make it less likely people will send empty messages.
249 (make-local-variable 'mail-send-hook) 263 (if report-emacs-bug-send-hook
250 (add-hook 'mail-send-hook 'report-emacs-bug-hook) 264 (add-hook report-emacs-bug-send-hook 'report-emacs-bug-hook nil t))
251 (save-excursion 265 (save-excursion
252 (goto-char (point-max)) 266 (goto-char (point-max))
253 (skip-chars-backward " \t\n") 267 (skip-chars-backward " \t\n")
254 (make-local-variable 'report-emacs-bug-orig-text) 268 (make-local-variable 'report-emacs-bug-orig-text)
255 (setq report-emacs-bug-orig-text (buffer-substring (point-min) (point)))) 269 (setq report-emacs-bug-orig-text
270 (buffer-substring-no-properties (point-min) (point))))
256 (goto-char user-point))) 271 (goto-char user-point)))
257 272
258(defun report-emacs-bug-info () 273(defun report-emacs-bug-info ()
@@ -261,53 +276,58 @@ usually do not have translators to read other languages for them.\n\n")
261 (info "(emacs)Bugs")) 276 (info "(emacs)Bugs"))
262 277
263(defun report-emacs-bug-hook () 278(defun report-emacs-bug-hook ()
279 "Do some checking before sending a bug report."
264 (save-excursion 280 (save-excursion
265 (save-excursion 281 (goto-char (point-max))
266 (goto-char (point-max)) 282 (skip-chars-backward " \t\n")
267 (skip-chars-backward " \t\n") 283 ;; FIXME This check is defeated by message.el, which sorts the
268 (if (and (= (- (point) (point-min)) 284 ;; headers (!) before running message-send-hook.
269 (length report-emacs-bug-orig-text)) 285 (and (= (- (point) (point-min))
270 (equal (buffer-substring (point-min) (point)) 286 (length report-emacs-bug-orig-text))
271 report-emacs-bug-orig-text)) 287 (string-equal (buffer-substring-no-properties (point-min) (point))
272 (error "No text entered in bug report"))) 288 report-emacs-bug-orig-text)
289 (error "No text entered in bug report"))
273 290
274 ;; Check the buffer contents and reject non-English letters. 291 ;; Check the buffer contents and reject non-English letters.
275 (save-excursion 292 ;; FIXME message-mode probably does this anyway.
276 (goto-char (point-min)) 293 (goto-char (point-min))
277 (skip-chars-forward "\0-\177") 294 (skip-chars-forward "\0-\177")
278 (if (not (eobp)) 295 (unless (eobp)
279 (if (or report-emacs-bug-no-confirmation 296 (if (or report-emacs-bug-no-confirmation
280 (y-or-n-p "Convert non-ASCII letters to hexadecimal? ")) 297 (y-or-n-p "Convert non-ASCII letters to hexadecimal? "))
281 (while (progn (skip-chars-forward "\0-\177") 298 (while (progn (skip-chars-forward "\0-\177")
282 (not (eobp))) 299 (not (eobp)))
283 (let ((ch (following-char))) 300 (let ((ch (following-char)))
284 (delete-char 1) 301 (delete-char 1)
285 (insert (format "=%02x" ch))))))) 302 (insert (format "=%02x" ch))))))
286 303
287 ;; The last warning for novice users. 304 ;; The last warning for novice users.
288 (if (or report-emacs-bug-no-confirmation 305 (unless (or report-emacs-bug-no-confirmation
289 (yes-or-no-p 306 (yes-or-no-p
290 "Send this bug report to the Emacs maintainers? ")) 307 "Send this bug report to the Emacs maintainers? "))
291 ;; Just send the current mail.
292 nil
293 (goto-char (point-min)) 308 (goto-char (point-min))
294 (if (search-forward "To: ") 309 (if (search-forward "To: ")
295 (let ((pos (point))) 310 (delete-region (point) (line-end-position)))
296 (end-of-line) 311 (if report-emacs-bug-send-hook
297 (delete-region pos (point)))) 312 (kill-local-variable report-emacs-bug-send-hook))
298 (kill-local-variable 'mail-send-hook)
299 (with-output-to-temp-buffer "*Bug Help*" 313 (with-output-to-temp-buffer "*Bug Help*"
300 (princ (substitute-command-keys "\ 314 (princ (substitute-command-keys
315 (format "\
301You invoked the command M-x report-emacs-bug, 316You invoked the command M-x report-emacs-bug,
302but you decided not to mail the bug report to the Emacs maintainers. 317but you decided not to mail the bug report to the Emacs maintainers.
303 318
304If you want to mail it to someone else instead, 319If you want to mail it to someone else instead,
305please insert the proper e-mail address after \"To: \", 320please insert the proper e-mail address after \"To: \",
306and send the mail again using \\[mail-send-and-exit]."))) 321and send the mail again%s."
322 (if report-emacs-bug-send-command
323 (format " using \\[%s]"
324 report-emacs-bug-send-command)
325 "")))))
307 (error "M-x report-emacs-bug was cancelled, please read *Bug Help* buffer")) 326 (error "M-x report-emacs-bug was cancelled, please read *Bug Help* buffer"))
308 327
309 ;; Unclutter 328 ;; Delete the uninteresting text that was just to help fill out the report.
310 (mail-text) 329 (rfc822-goto-eoh)
330 (forward-line 1)
311 (let ((pos (1- (point)))) 331 (let ((pos (1- (point))))
312 (while (setq pos (text-property-any pos (point-max) 332 (while (setq pos (text-property-any pos (point-max)
313 'field 'emacsbug-prompt)) 333 'field 'emacsbug-prompt))