Commit | Line | Data |
---|---|---|
55535639 | 1 | ;;; emacsbug.el --- command to report Emacs bugs to appropriate mailing list |
c0274f38 | 2 | |
c3153003 GM |
3 | ;; Copyright (C) 1985, 1994, 1997-1998, 2000-2014 |
4 | ;; Free Software Foundation, Inc. | |
9750e079 | 5 | |
e5167999 | 6 | ;; Author: K. Shane Hartman |
34dc21db | 7 | ;; Maintainer: emacs-devel@gnu.org |
fbd410d6 | 8 | ;; Keywords: maint mail |
bd78fa1d | 9 | ;; Package: emacs |
2f14b48d | 10 | |
a2535589 JA |
11 | ;; This file is part of GNU Emacs. |
12 | ||
b1fc2b50 | 13 | ;; GNU Emacs is free software: you can redistribute it and/or modify |
a2535589 | 14 | ;; it under the terms of the GNU General Public License as published by |
b1fc2b50 GM |
15 | ;; the Free Software Foundation, either version 3 of the License, or |
16 | ;; (at your option) any later version. | |
a2535589 JA |
17 | |
18 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | ;; GNU General Public License for more details. | |
22 | ||
23 | ;; You should have received a copy of the GNU General Public License | |
b1fc2b50 | 24 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
a2535589 | 25 | |
e41b2db1 ER |
26 | ;;; Commentary: |
27 | ||
b92a07e0 | 28 | ;; `M-x report-emacs-bug' starts an email note to the Emacs maintainers |
4d8da9a4 GM |
29 | ;; describing a problem. You need to be able to send mail from Emacs |
30 | ;; to complete the process. Alternatively, compose the bug report in | |
31 | ;; Emacs then paste it into your normal mail client. | |
e41b2db1 | 32 | |
2f14b48d | 33 | ;;; Code: |
a2535589 | 34 | |
cc26d239 LI |
35 | (require 'sendmail) |
36 | (require 'message) | |
37 | ||
fbd410d6 RS |
38 | (defgroup emacsbug nil |
39 | "Sending Emacs bug reports." | |
40 | :group 'maint | |
41 | :group 'mail) | |
42 | ||
27be0364 GM |
43 | (define-obsolete-variable-alias 'report-emacs-bug-pretest-address |
44 | 'report-emacs-bug-address "24.1") | |
45 | ||
fbd410d6 | 46 | (defcustom report-emacs-bug-no-confirmation nil |
4d8da9a4 | 47 | "If non-nil, suppress the confirmations asked for the sake of novice users." |
fbd410d6 RS |
48 | :group 'emacsbug |
49 | :type 'boolean) | |
50 | ||
51 | (defcustom report-emacs-bug-no-explanations nil | |
4d8da9a4 | 52 | "If non-nil, suppress the explanations given for the sake of novice users." |
fbd410d6 RS |
53 | :group 'emacsbug |
54 | :type 'boolean) | |
fe1d8b33 | 55 | |
4d8da9a4 GM |
56 | ;; User options end here. |
57 | ||
4d8da9a4 | 58 | (defvar report-emacs-bug-orig-text nil |
85094855 GM |
59 | "The automatically-created initial text of the bug report.") |
60 | ||
61 | (defvar report-emacs-bug-send-command nil | |
62 | "Name of the command to send the bug report, as a string.") | |
63 | (make-variable-buffer-local 'report-emacs-bug-send-command) | |
64 | ||
65 | (defvar report-emacs-bug-send-hook nil | |
66 | "Hook run before sending the bug report.") | |
67 | (make-variable-buffer-local 'report-emacs-bug-send-hook) | |
4d8da9a4 | 68 | |
aa360da1 GM |
69 | (declare-function x-server-vendor "xfns.c" (&optional terminal)) |
70 | (declare-function x-server-version "xfns.c" (&optional terminal)) | |
a0cefee5 | 71 | (declare-function message-sort-headers "message" ()) |
27be0364 | 72 | (defvar message-strip-special-text-properties) |
aa360da1 | 73 | |
253f7d1b | 74 | (defun report-emacs-bug-can-use-osx-open () |
3f88cd72 | 75 | "Return non-nil if the OS X \"open\" command is available for mailing." |
253f7d1b JD |
76 | (and (featurep 'ns) |
77 | (equal (executable-find "open") "/usr/bin/open") | |
78 | (memq system-type '(darwin)))) | |
79 | ||
3f88cd72 | 80 | ;; FIXME this duplicates much of the logic from browse-url-can-use-xdg-open. |
489cd5bd | 81 | (defun report-emacs-bug-can-use-xdg-email () |
3f88cd72 GM |
82 | "Return non-nil if the \"xdg-email\" command can be used. |
83 | xdg-email is a desktop utility that calls your preferred mail client. | |
84 | This requires you to be running either Gnome, KDE, or Xfce4." | |
489cd5bd JD |
85 | (and (getenv "DISPLAY") |
86 | (executable-find "xdg-email") | |
87 | (or (getenv "GNOME_DESKTOP_SESSION_ID") | |
88 | ;; GNOME_DESKTOP_SESSION_ID is deprecated, check on Dbus also. | |
89 | (condition-case nil | |
90 | (eq 0 (call-process | |
91 | "dbus-send" nil nil nil | |
92 | "--dest=org.gnome.SessionManager" | |
93 | "--print-reply" | |
94 | "/org/gnome/SessionManager" | |
95 | "org.gnome.SessionManager.CanShutdown")) | |
96 | (error nil)) | |
97 | (equal (getenv "KDE_FULL_SESSION") "true") | |
3f88cd72 GM |
98 | ;; FIXME? browse-url-can-use-xdg-open also accepts LXDE. |
99 | ;; Is that no good here, or just overlooked? | |
489cd5bd JD |
100 | (condition-case nil |
101 | (eq 0 (call-process | |
102 | "/bin/sh" nil nil nil | |
103 | "-c" | |
3f88cd72 | 104 | ;; FIXME use string-match rather than grep. |
489cd5bd JD |
105 | "xprop -root _DT_SAVE_MODE|grep xfce4")) |
106 | (error nil))))) | |
107 | ||
108 | (defun report-emacs-bug-insert-to-mailer () | |
3f88cd72 GM |
109 | "Send the message to your preferred mail client. |
110 | This requires either the OS X \"open\" command, or the freedesktop | |
111 | \"xdg-email\" command to be available." | |
489cd5bd JD |
112 | (interactive) |
113 | (save-excursion | |
3f88cd72 | 114 | ;; FIXME? use mail-fetch-field? |
489cd5bd JD |
115 | (let* ((to (progn |
116 | (goto-char (point-min)) | |
117 | (forward-line) | |
118 | (and (looking-at "^To: \\(.*\\)") | |
119 | (match-string-no-properties 1)))) | |
120 | (subject (progn | |
121 | (forward-line) | |
122 | (and (looking-at "^Subject: \\(.*\\)") | |
123 | (match-string-no-properties 1)))) | |
124 | (body (progn | |
125 | (forward-line 2) | |
126 | (if (> (point-max) (point)) | |
127 | (buffer-substring-no-properties (point) (point-max)))))) | |
128 | (if (and to subject body) | |
253f7d1b JD |
129 | (if (report-emacs-bug-can-use-osx-open) |
130 | (start-process "/usr/bin/open" nil "open" | |
7d15102b | 131 | (concat "mailto:" to |
253f7d1b JD |
132 | "?subject=" (url-hexify-string subject) |
133 | "&body=" (url-hexify-string body))) | |
134 | (start-process "xdg-email" nil "xdg-email" | |
135 | "--subject" subject | |
136 | "--body" body | |
137 | (concat "mailto:" to))) | |
489cd5bd JD |
138 | (error "Subject, To or body not found"))))) |
139 | ||
aa228418 | 140 | ;;;###autoload |
01753e63 | 141 | (defun report-emacs-bug (topic &optional recent-keys) |
aa228418 | 142 | "Report a bug in GNU Emacs. |
a2535589 | 143 | Prompts for bug subject. Leaves you in a mail buffer." |
01753e63 EN |
144 | ;; This strange form ensures that (recent-keys) is the value before |
145 | ;; the bug subject string is read. | |
146 | (interactive (reverse (list (recent-keys) (read-string "Bug Subject: ")))) | |
a722966c MC |
147 | ;; The syntax `version;' is preferred to `[version]' because the |
148 | ;; latter could be mistakenly stripped by mailing software. | |
ef77dde4 MC |
149 | (if (eq system-type 'ms-dos) |
150 | (setq topic (concat emacs-version "; " topic)) | |
151 | (when (string-match "^\\(\\([.0-9]+\\)*\\)\\.[0-9]+$" emacs-version) | |
152 | (setq topic (concat (match-string 1 emacs-version) "; " topic)))) | |
27be0364 | 153 | (let ((from-buffer (current-buffer)) |
253f7d1b JD |
154 | (can-insert-mail (or (report-emacs-bug-can-use-xdg-email) |
155 | (report-emacs-bug-can-use-osx-open))) | |
27be0364 | 156 | user-point message-end-point) |
0a18209b | 157 | (setq message-end-point |
90582f05 | 158 | (with-current-buffer (messages-buffer) |
0a18209b | 159 | (point-max-marker))) |
27be0364 | 160 | (compose-mail report-emacs-bug-address topic) |
2f1b7dc4 GM |
161 | ;; The rest of this does not execute if the user was asked to |
162 | ;; confirm and said no. | |
27be0364 GM |
163 | (when (eq major-mode 'message-mode) |
164 | ;; Message-mode sorts the headers before sending. We sort now so | |
165 | ;; that report-emacs-bug-orig-text remains valid. (Bug#5178) | |
166 | (message-sort-headers) | |
167 | ;; Stop message-mode stealing the properties we will add. | |
168 | (set (make-local-variable 'message-strip-special-text-properties) nil)) | |
9e68869b RS |
169 | (rfc822-goto-eoh) |
170 | (forward-line 1) | |
4443f204 RS |
171 | ;; Move the mail signature to the proper place. |
172 | (let ((signature (buffer-substring (point) (point-max))) | |
173 | (inhibit-read-only t)) | |
9e68869b | 174 | (delete-region (point) (point-max)) |
518adca2 RS |
175 | (insert signature) |
176 | (backward-char (length signature))) | |
fbd410d6 RS |
177 | (unless report-emacs-bug-no-explanations |
178 | ;; Insert warnings for novice users. | |
1176868d CY |
179 | (if (not (equal "bug-gnu-emacs@gnu.org" report-emacs-bug-address)) |
180 | (insert (format "The report will be sent to %s.\n\n" | |
181 | report-emacs-bug-address)) | |
182 | (insert "This bug report will be sent to the ") | |
030f4af5 | 183 | (insert-text-button |
1176868d CY |
184 | "Bug-GNU-Emacs" |
185 | 'face 'link | |
186 | 'help-echo (concat "mouse-2, RET: Follow this link") | |
187 | 'action (lambda (button) | |
188 | (browse-url "http://lists.gnu.org/archive/html/bug-gnu-emacs/")) | |
189 | 'follow-link t) | |
190 | (insert " mailing list\nand the GNU bug tracker at ") | |
030f4af5 | 191 | (insert-text-button |
1176868d CY |
192 | "debbugs.gnu.org" |
193 | 'face 'link | |
194 | 'help-echo (concat "mouse-2, RET: Follow this link") | |
195 | 'action (lambda (button) | |
196 | (browse-url "http://debbugs.gnu.org/")) | |
197 | 'follow-link t) | |
198 | ||
199 | (insert ". Please check that | |
200 | the From: line contains a valid email address. After a delay of up | |
09ae5da1 | 201 | to one day, you should receive an acknowledgment at that address. |
1176868d CY |
202 | |
203 | Please write in English if possible, as the Emacs maintainers | |
204 | usually do not have translators for other languages.\n\n"))) | |
205 | ||
206 | (insert "Please describe exactly what actions triggered the bug, and\n" | |
207 | "the precise symptoms of the bug. If you can, give a recipe\n" | |
208 | "starting from `emacs -Q':\n\n") | |
030f4af5 SM |
209 | (let ((txt (delete-and-extract-region |
210 | (save-excursion (rfc822-goto-eoh) (line-beginning-position 2)) | |
211 | (point)))) | |
212 | (insert (propertize "\n" 'display txt))) | |
515ced27 | 213 | (setq user-point (point)) |
3a7f4c18 KS |
214 | (insert "\n\n") |
215 | ||
fca615d5 | 216 | (insert "If Emacs crashed, and you have the Emacs process in the gdb debugger,\n" |
3a7f4c18 KS |
217 | "please include the output from the following gdb commands:\n" |
218 | " `bt full' and `xbacktrace'.\n") | |
219 | ||
220 | (let ((debug-file (expand-file-name "DEBUG" data-directory))) | |
221 | (if (file-readable-p debug-file) | |
00006066 CY |
222 | (insert "For information about debugging Emacs, please read the file\n" |
223 | debug-file ".\n"))) | |
030f4af5 SM |
224 | (let ((txt (delete-and-extract-region (1+ user-point) (point)))) |
225 | (insert (propertize "\n" 'display txt))) | |
515ced27 | 226 | |
3a7f4c18 | 227 | (insert "\n\nIn " (emacs-version) "\n") |
9475054f ER |
228 | (if (stringp emacs-repository-version) |
229 | (insert "Repository revision: " emacs-repository-version "\n")) | |
f4982064 | 230 | (if (fboundp 'x-server-vendor) |
6f8a2742 | 231 | (condition-case nil |
951c155f SM |
232 | ;; This is used not only for X11 but also W32 and others. |
233 | (insert "Windowing system distributor `" (x-server-vendor) | |
234 | "', version " | |
6f8a2742 JD |
235 | (mapconcat 'number-to-string (x-server-version) ".") "\n") |
236 | (error t))) | |
bcc0adbf GM |
237 | (let ((lsb (with-temp-buffer |
238 | (if (eq 0 (ignore-errors | |
239 | (call-process "lsb_release" nil '(t nil) | |
240 | nil "-d"))) | |
241 | (buffer-string))))) | |
242 | (if (stringp lsb) | |
1feca5a2 | 243 | (insert "System " lsb "\n"))) |
4d4ec1f8 EZ |
244 | (when (and system-configuration-options |
245 | (not (equal system-configuration-options ""))) | |
246 | (insert "Configured using:\n `configure " | |
247 | system-configuration-options "'\n\n") | |
248 | (fill-region (line-beginning-position -1) (point))) | |
c3153003 GM |
249 | (insert "Configured features:\n" system-configuration-features "\n\n") |
250 | (fill-region (line-beginning-position -1) (point)) | |
dc81f8a2 | 251 | (insert "Important settings:\n") |
1daad47d | 252 | (mapc |
4f91a816 | 253 | (lambda (var) |
2b48d721 GM |
254 | (let ((val (getenv var))) |
255 | (if val (insert (format " value of $%s: %s\n" var val))))) | |
256 | '("EMACSDATA" "EMACSDOC" "EMACSLOADPATH" "EMACSPATH" | |
257 | "LC_ALL" "LC_COLLATE" "LC_CTYPE" "LC_MESSAGES" | |
5dae4230 | 258 | "LC_MONETARY" "LC_NUMERIC" "LC_TIME" "LANG" "XMODIFIERS")) |
dc81f8a2 | 259 | (insert (format " locale-coding-system: %s\n" locale-coding-system)) |
ccc9f6dc GM |
260 | ;; Only ~ 0.2% of people from a sample of 3200 changed this from |
261 | ;; the default, t. | |
262 | (or (default-value 'enable-multibyte-characters) | |
263 | (insert (format " default enable-multibyte-characters: %s\n" | |
264 | (default-value 'enable-multibyte-characters)))) | |
0a18209b | 265 | (insert "\n") |
3c3ba27b | 266 | (insert (format "Major mode: %s\n" |
48d33090 SM |
267 | (format-mode-line |
268 | (buffer-local-value 'mode-name from-buffer) | |
269 | nil nil from-buffer))) | |
e927088b RS |
270 | (insert "\n") |
271 | (insert "Minor modes in effect:\n") | |
272 | (dolist (mode minor-mode-list) | |
3c3ba27b RS |
273 | (and (boundp mode) (buffer-local-value mode from-buffer) |
274 | (insert (format " %s: %s\n" mode | |
275 | (buffer-local-value mode from-buffer))))) | |
e927088b | 276 | (insert "\n") |
515ced27 | 277 | (insert "Recent input:\n") |
0a18209b KH |
278 | (let ((before-keys (point))) |
279 | (insert (mapconcat (lambda (key) | |
280 | (if (or (integerp key) | |
281 | (symbolp key) | |
282 | (listp key)) | |
283 | (single-key-description key) | |
284 | (prin1-to-string key nil))) | |
285 | (or recent-keys (recent-keys)) | |
286 | " ")) | |
287 | (save-restriction | |
288 | (narrow-to-region before-keys (point)) | |
289 | (goto-char before-keys) | |
290 | (while (progn (move-to-column 50) (not (eobp))) | |
291 | (search-forward " " nil t) | |
292 | (insert "\n")))) | |
293 | (let ((message-buf (get-buffer "*Messages*"))) | |
294 | (if message-buf | |
295 | (let (beg-pos | |
296 | (end-pos message-end-point)) | |
297 | (with-current-buffer message-buf | |
298 | (goto-char end-pos) | |
299 | (forward-line -10) | |
300 | (setq beg-pos (point))) | |
301 | (insert "\n\nRecent messages:\n") | |
302 | (insert-buffer-substring message-buf beg-pos end-pos)))) | |
0b952197 GM |
303 | ;; After Recent messages, to avoid the messages produced by |
304 | ;; list-load-path-shadows. | |
305 | (unless (looking-back "\n") | |
306 | (insert "\n")) | |
307 | (insert "\n") | |
308 | (insert "Load-path shadows:\n") | |
fa05bfe0 GM |
309 | (let* ((msg "Checking for load-path shadows...") |
310 | (result "done") | |
311 | (shadows (progn (message "%s" msg) | |
312 | (condition-case nil (list-load-path-shadows t) | |
313 | (error | |
314 | (setq result "error") | |
315 | "Error during checking"))))) | |
316 | (message "%s%s" msg result) | |
0b952197 GM |
317 | (insert (if (zerop (length shadows)) |
318 | "None found.\n" | |
319 | shadows))) | |
9656d87b GM |
320 | (insert (format "\nFeatures:\n%s\n" features)) |
321 | (fill-region (line-beginning-position 0) (point)) | |
0d8ac93e DC |
322 | |
323 | (insert (format "\nMemory information:\n")) | |
324 | (pp (garbage-collect) (current-buffer)) | |
325 | ||
9656d87b | 326 | ;; This is so the user has to type something in order to send easily. |
0a18209b | 327 | (use-local-map (nconc (make-sparse-keymap) (current-local-map))) |
3290526d | 328 | (define-key (current-local-map) "\C-c\C-i" 'info-emacs-bug) |
253f7d1b | 329 | (if can-insert-mail |
e78e7e48 | 330 | (define-key (current-local-map) "\C-c\M-i" |
489cd5bd | 331 | 'report-emacs-bug-insert-to-mailer)) |
e554b3f8 GM |
332 | (setq report-emacs-bug-send-command (get mail-user-agent 'sendfunc) |
333 | report-emacs-bug-send-hook (get mail-user-agent 'hookvar)) | |
334 | (if report-emacs-bug-send-command | |
335 | (setq report-emacs-bug-send-command | |
336 | (symbol-name report-emacs-bug-send-command))) | |
e9227982 RS |
337 | (unless report-emacs-bug-no-explanations |
338 | (with-output-to-temp-buffer "*Bug Help*" | |
3e425845 | 339 | (princ "While in the mail buffer:\n\n") |
85094855 | 340 | (if report-emacs-bug-send-command |
d8194864 | 341 | (princ (substitute-command-keys |
85094855 GM |
342 | (format " Type \\[%s] to send the bug report.\n" |
343 | report-emacs-bug-send-command)))) | |
e9227982 | 344 | (princ (substitute-command-keys |
3e425845 | 345 | " Type \\[kill-buffer] RET to cancel (don't send it).\n")) |
253f7d1b | 346 | (if can-insert-mail |
489cd5bd | 347 | (princ (substitute-command-keys |
3f88cd72 | 348 | " Type \\[report-emacs-bug-insert-to-mailer] to copy text to your preferred mail program.\n"))) |
e9227982 RS |
349 | (terpri) |
350 | (princ (substitute-command-keys | |
cb1f695c | 351 | " Type \\[info-emacs-bug] to visit in Info the Emacs Manual section |
3e425845 CY |
352 | about when and how to write a bug report, and what |
353 | information you should include to help fix the bug."))) | |
354 | (shrink-window-if-larger-than-buffer (get-buffer-window "*Bug Help*"))) | |
0a18209b | 355 | ;; Make it less likely people will send empty messages. |
85094855 GM |
356 | (if report-emacs-bug-send-hook |
357 | (add-hook report-emacs-bug-send-hook 'report-emacs-bug-hook nil t)) | |
2f1b7dc4 GM |
358 | (goto-char (point-max)) |
359 | (skip-chars-backward " \t\n") | |
360 | (make-local-variable 'report-emacs-bug-orig-text) | |
361 | (setq report-emacs-bug-orig-text | |
362 | (buffer-substring-no-properties (point-min) (point))) | |
0a18209b | 363 | (goto-char user-point))) |
e24ec555 | 364 | |
2a1e2476 | 365 | (define-obsolete-function-alias 'report-emacs-bug-info 'info-emacs-bug "24.3") |
1628adc6 | 366 | |
7d15102b GM |
367 | ;; It's the default mail mode, so it seems OK to use its features. |
368 | (autoload 'message-bogus-recipient-p "message") | |
d1a5d56a | 369 | (defvar message-send-mail-function) |
7d15102b | 370 | |
e24ec555 | 371 | (defun report-emacs-bug-hook () |
85094855 | 372 | "Do some checking before sending a bug report." |
e24ec555 | 373 | (save-excursion |
85094855 GM |
374 | (goto-char (point-max)) |
375 | (skip-chars-backward " \t\n") | |
85094855 GM |
376 | (and (= (- (point) (point-min)) |
377 | (length report-emacs-bug-orig-text)) | |
378 | (string-equal (buffer-substring-no-properties (point-min) (point)) | |
379 | report-emacs-bug-orig-text) | |
380 | (error "No text entered in bug report")) | |
cc26d239 | 381 | ;; Warning for novice users. |
85094855 | 382 | (unless (or report-emacs-bug-no-confirmation |
7d15102b GM |
383 | (yes-or-no-p |
384 | "Send this bug report to the Emacs maintainers? ")) | |
fe1d8b33 KH |
385 | (goto-char (point-min)) |
386 | (if (search-forward "To: ") | |
85094855 GM |
387 | (delete-region (point) (line-end-position))) |
388 | (if report-emacs-bug-send-hook | |
389 | (kill-local-variable report-emacs-bug-send-hook)) | |
fe1d8b33 | 390 | (with-output-to-temp-buffer "*Bug Help*" |
85094855 GM |
391 | (princ (substitute-command-keys |
392 | (format "\ | |
02f6b354 RS |
393 | You invoked the command M-x report-emacs-bug, |
394 | but you decided not to mail the bug report to the Emacs maintainers. | |
fe1d8b33 | 395 | |
02f6b354 RS |
396 | If you want to mail it to someone else instead, |
397 | please insert the proper e-mail address after \"To: \", | |
85094855 GM |
398 | and send the mail again%s." |
399 | (if report-emacs-bug-send-command | |
400 | (format " using \\[%s]" | |
401 | report-emacs-bug-send-command) | |
402 | ""))))) | |
d5081c1e | 403 | (error "M-x report-emacs-bug was canceled, please read *Bug Help* buffer")) |
cc26d239 LI |
404 | ;; Query the user for the SMTP method, so that we can skip |
405 | ;; questions about From header validity if the user is going to | |
406 | ;; use mailclient, anyway. | |
fbae4637 | 407 | (when (or (and (derived-mode-p 'message-mode) |
e627be4c | 408 | (eq message-send-mail-function 'sendmail-query-once)) |
fbae4637 LMI |
409 | (and (not (derived-mode-p 'message-mode)) |
410 | (eq send-mail-function 'sendmail-query-once))) | |
cc26d239 LI |
411 | (sendmail-query-user-about-smtp) |
412 | (when (derived-mode-p 'message-mode) | |
413 | (setq message-send-mail-function (message-default-send-mail-function)))) | |
414 | (or report-emacs-bug-no-confirmation | |
415 | ;; mailclient.el does not need a valid From | |
416 | (if (derived-mode-p 'message-mode) | |
417 | (eq message-send-mail-function 'message-send-mail-with-mailclient) | |
418 | (eq send-mail-function 'mailclient-send-it)) | |
419 | ;; Not narrowing to the headers, but that's OK. | |
420 | (let ((from (mail-fetch-field "From"))) | |
421 | (and (or (not from) | |
422 | (message-bogus-recipient-p from) | |
423 | ;; This is the default user-mail-address. On today's | |
424 | ;; systems, it seems more likely to be wrong than right, | |
425 | ;; since most people don't run their own mail server. | |
426 | (string-match (format "\\<%s@%s\\>" | |
427 | (regexp-quote (user-login-name)) | |
428 | (regexp-quote (system-name))) | |
429 | from)) | |
430 | (not (yes-or-no-p | |
431 | (format "Is `%s' really your email address? " from))) | |
030f4af5 | 432 | (error "Please edit the From address and try again")))))) |
a2535589 | 433 | |
614316a7 | 434 | |
8e0ff8c8 ER |
435 | (provide 'emacsbug) |
436 | ||
c0274f38 | 437 | ;;; emacsbug.el ends here |