aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Djärv2011-01-30 19:59:58 +0100
committerJan Djärv2011-01-30 19:59:58 +0100
commit253f7d1bc55aec58986aa36f8a6e4725d311ed24 (patch)
tree22abf993be7270f524167c69a4df217a8d617852
parent2787bba35d57d7963857536d35a7d5adc215a0d9 (diff)
downloademacs-253f7d1bc55aec58986aa36f8a6e4725d311ed24.tar.gz
emacs-253f7d1bc55aec58986aa36f8a6e4725d311ed24.zip
Implement C-c m in report-emacs-bug (insert to mailer) for OSX.
* mail/emacsbug.el (report-emacs-bug-insert-to-mailer): Check report-emacs-bug-can-use-osx-open and use that if t. (report-emacs-bug-can-use-osx-open): New function. (report-emacs-bug): Rename can-xdg-email to can-insert-mail. Check report-emacs-bug-can-use-osx-open also for can-insert-mail.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/mail/emacsbug.el28
2 files changed, 29 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c9bdafebe8a..f69b32a4878 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12011-01-30 Jan Djärv <jan.h.d@swipnet.se>
2
3 * mail/emacsbug.el (report-emacs-bug-insert-to-mailer): Check
4 report-emacs-bug-can-use-osx-open and use that if t.
5 (report-emacs-bug-can-use-osx-open): New function.
6 (report-emacs-bug): Rename can-xdg-email to can-insert-mail.
7 Check report-emacs-bug-can-use-osx-open also for can-insert-mail.
8
12011-01-29 Chong Yidong <cyd@stupidchicken.com> 92011-01-29 Chong Yidong <cyd@stupidchicken.com>
2 10
3 * vc/vc-dispatcher.el (vc-set-async-update): New function for 11 * vc/vc-dispatcher.el (vc-set-async-update): New function for
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index 44cfc76d808..a621647bcf1 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -32,6 +32,8 @@
32 32
33;;; Code: 33;;; Code:
34 34
35(require 'url-util)
36
35(defgroup emacsbug nil 37(defgroup emacsbug nil
36 "Sending Emacs bug reports." 38 "Sending Emacs bug reports."
37 :group 'maint 39 :group 'maint
@@ -77,6 +79,12 @@ Used for querying duplicates and linking to existing bugs.")
77(declare-function message-sort-headers "message" ()) 79(declare-function message-sort-headers "message" ())
78(defvar message-strip-special-text-properties) 80(defvar message-strip-special-text-properties)
79 81
82(defun report-emacs-bug-can-use-osx-open ()
83 "Check if OSX open can be used to insert bug report into mailer"
84 (and (featurep 'ns)
85 (equal (executable-find "open") "/usr/bin/open")
86 (memq system-type '(darwin))))
87
80(defun report-emacs-bug-can-use-xdg-email () 88(defun report-emacs-bug-can-use-xdg-email ()
81 "Check if xdg-email can be used, i.e. we are on Gnome, KDE or xfce4." 89 "Check if xdg-email can be used, i.e. we are on Gnome, KDE or xfce4."
82 (and (getenv "DISPLAY") 90 (and (getenv "DISPLAY")
@@ -116,10 +124,15 @@ Used for querying duplicates and linking to existing bugs.")
116 (if (> (point-max) (point)) 124 (if (> (point-max) (point))
117 (buffer-substring-no-properties (point) (point-max)))))) 125 (buffer-substring-no-properties (point) (point-max))))))
118 (if (and to subject body) 126 (if (and to subject body)
119 (start-process "xdg-email" nil "xdg-email" 127 (if (report-emacs-bug-can-use-osx-open)
120 "--subject" subject 128 (start-process "/usr/bin/open" nil "open"
121 "--body" body 129 (concat "mailto:" to
122 (concat "mailto:" to)) 130 "?subject=" (url-hexify-string subject)
131 "&body=" (url-hexify-string body)))
132 (start-process "xdg-email" nil "xdg-email"
133 "--subject" subject
134 "--body" body
135 (concat "mailto:" to)))
123 (error "Subject, To or body not found"))))) 136 (error "Subject, To or body not found")))))
124 137
125;;;###autoload 138;;;###autoload
@@ -141,7 +154,8 @@ Prompts for bug subject. Leaves you in a mail buffer."
141 (prompt-properties '(field emacsbug-prompt 154 (prompt-properties '(field emacsbug-prompt
142 intangible but-helpful 155 intangible but-helpful
143 rear-nonsticky t)) 156 rear-nonsticky t))
144 (can-xdg-email (report-emacs-bug-can-use-xdg-email)) 157 (can-insert-mail (or (report-emacs-bug-can-use-xdg-email)
158 (report-emacs-bug-can-use-osx-open)))
145 user-point message-end-point) 159 user-point message-end-point)
146 (setq message-end-point 160 (setq message-end-point
147 (with-current-buffer (get-buffer-create "*Messages*") 161 (with-current-buffer (get-buffer-create "*Messages*")
@@ -275,7 +289,7 @@ usually do not have translators to read other languages for them.\n\n")
275 ;; This is so the user has to type something in order to send easily. 289 ;; This is so the user has to type something in order to send easily.
276 (use-local-map (nconc (make-sparse-keymap) (current-local-map))) 290 (use-local-map (nconc (make-sparse-keymap) (current-local-map)))
277 (define-key (current-local-map) "\C-c\C-i" 'report-emacs-bug-info) 291 (define-key (current-local-map) "\C-c\C-i" 'report-emacs-bug-info)
278 (if can-xdg-email 292 (if can-insert-mail
279 (define-key (current-local-map) "\C-cm" 293 (define-key (current-local-map) "\C-cm"
280 'report-emacs-bug-insert-to-mailer)) 294 'report-emacs-bug-insert-to-mailer))
281 (setq report-emacs-bug-send-command (get mail-user-agent 'sendfunc) 295 (setq report-emacs-bug-send-command (get mail-user-agent 'sendfunc)
@@ -292,7 +306,7 @@ usually do not have translators to read other languages for them.\n\n")
292 report-emacs-bug-send-command)))) 306 report-emacs-bug-send-command))))
293 (princ (substitute-command-keys 307 (princ (substitute-command-keys
294 " Type \\[kill-buffer] RET to cancel (don't send it).\n")) 308 " Type \\[kill-buffer] RET to cancel (don't send it).\n"))
295 (if can-xdg-email 309 (if can-insert-mail
296 (princ (substitute-command-keys 310 (princ (substitute-command-keys
297 " Type \\[report-emacs-bug-insert-to-mailer] to insert text to you preferred mail program.\n"))) 311 " Type \\[report-emacs-bug-insert-to-mailer] to insert text to you preferred mail program.\n")))
298 (terpri) 312 (terpri)