emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103034: Implement C-c m in report-em


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103034: Implement C-c m in report-emacs-bug (insert to mailer) for OSX.
Date: Sun, 30 Jan 2011 19:59:58 +0100
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103034
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Sun 2011-01-30 19:59:58 +0100
message:
  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.
modified:
  lisp/ChangeLog
  lisp/mail/emacsbug.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-01-29 21:19:21 +0000
+++ b/lisp/ChangeLog    2011-01-30 18:59:58 +0000
@@ -1,3 +1,11 @@
+2011-01-30  Jan Djärv  <address@hidden>
+
+       * 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.
+
 2011-01-29  Chong Yidong  <address@hidden>
 
        * vc/vc-dispatcher.el (vc-set-async-update): New function for

=== modified file 'lisp/mail/emacsbug.el'
--- a/lisp/mail/emacsbug.el     2011-01-25 04:08:28 +0000
+++ b/lisp/mail/emacsbug.el     2011-01-30 18:59:58 +0000
@@ -32,6 +32,8 @@
 
 ;;; Code:
 
+(require 'url-util)
+
 (defgroup emacsbug nil
   "Sending Emacs bug reports."
   :group 'maint
@@ -77,6 +79,12 @@
 (declare-function message-sort-headers "message" ())
 (defvar message-strip-special-text-properties)
 
+(defun report-emacs-bug-can-use-osx-open ()
+  "Check if OSX open can be used to insert bug report into mailer"
+  (and (featurep 'ns)
+       (equal (executable-find "open") "/usr/bin/open")
+       (memq system-type '(darwin))))
+
 (defun report-emacs-bug-can-use-xdg-email ()
   "Check if xdg-email can be used, i.e. we are on Gnome, KDE or xfce4."
   (and (getenv "DISPLAY")
@@ -116,10 +124,15 @@
                   (if (> (point-max) (point))
                       (buffer-substring-no-properties (point) (point-max))))))
       (if (and to subject body)
-         (start-process "xdg-email" nil "xdg-email"
-                        "--subject" subject
-                        "--body" body
-                        (concat "mailto:"; to))
+         (if (report-emacs-bug-can-use-osx-open)
+             (start-process "/usr/bin/open" nil "open"
+                            (concat "mailto:"; to 
+                                    "?subject=" (url-hexify-string subject)
+                                    "&body=" (url-hexify-string body)))
+           (start-process "xdg-email" nil "xdg-email"
+                          "--subject" subject
+                          "--body" body
+                          (concat "mailto:"; to)))
        (error "Subject, To or body not found")))))
 
 ;;;###autoload
@@ -141,7 +154,8 @@
         (prompt-properties '(field emacsbug-prompt
                                    intangible but-helpful
                                    rear-nonsticky t))
-       (can-xdg-email (report-emacs-bug-can-use-xdg-email))
+       (can-insert-mail (or (report-emacs-bug-can-use-xdg-email)
+                            (report-emacs-bug-can-use-osx-open)))
         user-point message-end-point)
     (setq message-end-point
          (with-current-buffer (get-buffer-create "*Messages*")
@@ -275,7 +289,7 @@
     ;; This is so the user has to type something in order to send easily.
     (use-local-map (nconc (make-sparse-keymap) (current-local-map)))
     (define-key (current-local-map) "\C-c\C-i" 'report-emacs-bug-info)
-    (if can-xdg-email
+    (if can-insert-mail
        (define-key (current-local-map) "\C-cm"
          'report-emacs-bug-insert-to-mailer))
     (setq report-emacs-bug-send-command (get mail-user-agent 'sendfunc)
@@ -292,7 +306,7 @@
                             report-emacs-bug-send-command))))
        (princ (substitute-command-keys
                "  Type \\[kill-buffer] RET to cancel (don't send it).\n"))
-       (if can-xdg-email
+       (if can-insert-mail
            (princ (substitute-command-keys
                    "  Type \\[report-emacs-bug-insert-to-mailer] to insert 
text to you preferred mail program.\n")))
        (terpri)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]