diff options
| author | Jan Djärv | 2010-08-17 12:07:41 +0200 |
|---|---|---|
| committer | Jan Djärv | 2010-08-17 12:07:41 +0200 |
| commit | 489cd5bd5a0128d6c3bee49fa2c451f2927ddea9 (patch) | |
| tree | 577fd87c79879e2096335b3e0634840517b0e69b | |
| parent | 2269b349e3fc1cbe63879291f35e52dc291c881a (diff) | |
| download | emacs-489cd5bd5a0128d6c3bee49fa2c451f2927ddea9.tar.gz emacs-489cd5bd5a0128d6c3bee49fa2c451f2927ddea9.zip | |
Add command C-c m in report-emacs-bug that puts the bug into preferred mailer.
Depends on xdg-email being available.
* lisp/mail/emacsbug.el (report-emacs-bug-insert-to-mailer)
(report-emacs-bug-can-use-xdg-email): New functions.
(report-emacs-bug): Set can-xdg-email to result of
report-emacs-bug-can-use-xdg-email. If can-xdg-email bind
\C-cm to report-emacs-bug-insert-to-mailer and add help text
about it.
| -rw-r--r-- | lisp/ChangeLog | 19 | ||||
| -rw-r--r-- | lisp/mail/emacsbug.el | 53 |
2 files changed, 59 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1ae275213b3..0087163f097 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,18 +1,11 @@ | |||
| 1 | 2010-08-17 Jan Djärv <jan.h.d@swipnet.se> | 1 | 2010-08-17 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 2 | ||
| 3 | * net/browse-url.el (browse-url-default-browser): Add cond | 3 | * mail/emacsbug.el (report-emacs-bug-insert-to-mailer) |
| 4 | for browse-url-xdg-open | 4 | (report-emacs-bug-can-use-xdg-email): New functions. |
| 5 | (browse-url-can-use-xdg-open, browse-url-xdg-open): New functions | 5 | (report-emacs-bug): Set can-xdg-email to result of |
| 6 | 6 | report-emacs-bug-can-use-xdg-email. If can-xdg-email bind | |
| 7 | 2010-08-17 Glenn Morris <rgm@gnu.org> | 7 | \C-cm to report-emacs-bug-insert-to-mailer and add help text |
| 8 | 8 | about it. | |
| 9 | * progmodes/cc-engine.el (c-new-BEG, c-new-END) | ||
| 10 | (c-fontify-recorded-types-and-refs): Define for compiler. | ||
| 11 | * progmodes/cc-mode.el (c-new-BEG, c-new-END): Move definitions | ||
| 12 | before use. | ||
| 13 | |||
| 14 | * calendar/icalendar.el (icalendar--convert-recurring-to-diary): | ||
| 15 | Fix format call. | ||
| 16 | 9 | ||
| 17 | 2010-08-17 Michael Albinus <michael.albinus@gmx.de> | 10 | 2010-08-17 Michael Albinus <michael.albinus@gmx.de> |
| 18 | 11 | ||
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index 478d7aa075f..91242b98aeb 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el | |||
| @@ -74,6 +74,52 @@ | |||
| 74 | (declare-function message-sort-headers "message" ()) | 74 | (declare-function message-sort-headers "message" ()) |
| 75 | (defvar message-strip-special-text-properties) | 75 | (defvar message-strip-special-text-properties) |
| 76 | 76 | ||
| 77 | (defun report-emacs-bug-can-use-xdg-email () | ||
| 78 | "Check if xdg-email can be used, i.e. we are on Gnome, KDE or xfce4." | ||
| 79 | (and (getenv "DISPLAY") | ||
| 80 | (executable-find "xdg-email") | ||
| 81 | (or (getenv "GNOME_DESKTOP_SESSION_ID") | ||
| 82 | ;; GNOME_DESKTOP_SESSION_ID is deprecated, check on Dbus also. | ||
| 83 | (condition-case nil | ||
| 84 | (eq 0 (call-process | ||
| 85 | "dbus-send" nil nil nil | ||
| 86 | "--dest=org.gnome.SessionManager" | ||
| 87 | "--print-reply" | ||
| 88 | "/org/gnome/SessionManager" | ||
| 89 | "org.gnome.SessionManager.CanShutdown")) | ||
| 90 | (error nil)) | ||
| 91 | (equal (getenv "KDE_FULL_SESSION") "true") | ||
| 92 | (condition-case nil | ||
| 93 | (eq 0 (call-process | ||
| 94 | "/bin/sh" nil nil nil | ||
| 95 | "-c" | ||
| 96 | "xprop -root _DT_SAVE_MODE|grep xfce4")) | ||
| 97 | (error nil))))) | ||
| 98 | |||
| 99 | (defun report-emacs-bug-insert-to-mailer () | ||
| 100 | (interactive) | ||
| 101 | (save-excursion | ||
| 102 | (let* ((to (progn | ||
| 103 | (goto-char (point-min)) | ||
| 104 | (forward-line) | ||
| 105 | (and (looking-at "^To: \\(.*\\)") | ||
| 106 | (match-string-no-properties 1)))) | ||
| 107 | (subject (progn | ||
| 108 | (forward-line) | ||
| 109 | (and (looking-at "^Subject: \\(.*\\)") | ||
| 110 | (match-string-no-properties 1)))) | ||
| 111 | (body (progn | ||
| 112 | (forward-line 2) | ||
| 113 | (if (> (point-max) (point)) | ||
| 114 | (buffer-substring-no-properties (point) (point-max)))))) | ||
| 115 | (if (and to subject body) | ||
| 116 | (start-process "xdg-email" nil "xdg-email" | ||
| 117 | "--subject" subject | ||
| 118 | "--body" body | ||
| 119 | (concat "mailto:" to)) | ||
| 120 | (error "Subject, To or body not found"))))) | ||
| 121 | |||
| 122 | |||
| 77 | ;;;###autoload | 123 | ;;;###autoload |
| 78 | (defun report-emacs-bug (topic &optional recent-keys) | 124 | (defun report-emacs-bug (topic &optional recent-keys) |
| 79 | "Report a bug in GNU Emacs. | 125 | "Report a bug in GNU Emacs. |
| @@ -93,6 +139,7 @@ Prompts for bug subject. Leaves you in a mail buffer." | |||
| 93 | (prompt-properties '(field emacsbug-prompt | 139 | (prompt-properties '(field emacsbug-prompt |
| 94 | intangible but-helpful | 140 | intangible but-helpful |
| 95 | rear-nonsticky t)) | 141 | rear-nonsticky t)) |
| 142 | (can-xdg-email (report-emacs-bug-can-use-xdg-email)) | ||
| 96 | user-point message-end-point) | 143 | user-point message-end-point) |
| 97 | (setq message-end-point | 144 | (setq message-end-point |
| 98 | (with-current-buffer (get-buffer-create "*Messages*") | 145 | (with-current-buffer (get-buffer-create "*Messages*") |
| @@ -226,6 +273,9 @@ usually do not have translators to read other languages for them.\n\n") | |||
| 226 | ;; This is so the user has to type something in order to send easily. | 273 | ;; This is so the user has to type something in order to send easily. |
| 227 | (use-local-map (nconc (make-sparse-keymap) (current-local-map))) | 274 | (use-local-map (nconc (make-sparse-keymap) (current-local-map))) |
| 228 | (define-key (current-local-map) "\C-c\C-i" 'report-emacs-bug-info) | 275 | (define-key (current-local-map) "\C-c\C-i" 'report-emacs-bug-info) |
| 276 | (if can-xdg-email | ||
| 277 | (define-key (current-local-map) "\C-cm" | ||
| 278 | 'report-emacs-bug-insert-to-mailer)) | ||
| 229 | ;; Could test major-mode instead. | 279 | ;; Could test major-mode instead. |
| 230 | (cond ((memq mail-user-agent '(message-user-agent gnus-user-agent)) | 280 | (cond ((memq mail-user-agent '(message-user-agent gnus-user-agent)) |
| 231 | (setq report-emacs-bug-send-command "message-send-and-exit" | 281 | (setq report-emacs-bug-send-command "message-send-and-exit" |
| @@ -245,6 +295,9 @@ usually do not have translators to read other languages for them.\n\n") | |||
| 245 | report-emacs-bug-send-command)))) | 295 | report-emacs-bug-send-command)))) |
| 246 | (princ (substitute-command-keys | 296 | (princ (substitute-command-keys |
| 247 | " Type \\[kill-buffer] RET to cancel (don't send it).\n")) | 297 | " Type \\[kill-buffer] RET to cancel (don't send it).\n")) |
| 298 | (if can-xdg-email | ||
| 299 | (princ (substitute-command-keys | ||
| 300 | " Type \\[report-emacs-bug-insert-to-mailer] to insert text to you preferred mail program.\n"))) | ||
| 248 | (terpri) | 301 | (terpri) |
| 249 | (princ (substitute-command-keys | 302 | (princ (substitute-command-keys |
| 250 | " Type \\[report-emacs-bug-info] to visit in Info the Emacs Manual section | 303 | " Type \\[report-emacs-bug-info] to visit in Info the Emacs Manual section |