[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r101106: Add command C-c m in report-
From: |
Jan D. |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r101106: Add command C-c m in report-emacs-bug that puts the bug into preferred mailer. |
Date: |
Tue, 17 Aug 2010 12:07:41 +0200 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 101106
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Tue 2010-08-17 12:07:41 +0200
message:
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.
modified:
lisp/ChangeLog
lisp/mail/emacsbug.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2010-08-17 08:01:10 +0000
+++ b/lisp/ChangeLog 2010-08-17 10:07:41 +0000
@@ -1,18 +1,11 @@
2010-08-17 Jan Djärv <address@hidden>
- * net/browse-url.el (browse-url-default-browser): Add cond
- for browse-url-xdg-open
- (browse-url-can-use-xdg-open, browse-url-xdg-open): New functions
-
-2010-08-17 Glenn Morris <address@hidden>
-
- * progmodes/cc-engine.el (c-new-BEG, c-new-END)
- (c-fontify-recorded-types-and-refs): Define for compiler.
- * progmodes/cc-mode.el (c-new-BEG, c-new-END): Move definitions
- before use.
-
- * calendar/icalendar.el (icalendar--convert-recurring-to-diary):
- Fix format call.
+ * 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.
2010-08-17 Michael Albinus <address@hidden>
=== modified file 'lisp/mail/emacsbug.el'
--- a/lisp/mail/emacsbug.el 2010-03-18 06:18:47 +0000
+++ b/lisp/mail/emacsbug.el 2010-08-17 10:07:41 +0000
@@ -74,6 +74,52 @@
(declare-function message-sort-headers "message" ())
(defvar message-strip-special-text-properties)
+(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")
+ (executable-find "xdg-email")
+ (or (getenv "GNOME_DESKTOP_SESSION_ID")
+ ;; GNOME_DESKTOP_SESSION_ID is deprecated, check on Dbus also.
+ (condition-case nil
+ (eq 0 (call-process
+ "dbus-send" nil nil nil
+ "--dest=org.gnome.SessionManager"
+ "--print-reply"
+ "/org/gnome/SessionManager"
+ "org.gnome.SessionManager.CanShutdown"))
+ (error nil))
+ (equal (getenv "KDE_FULL_SESSION") "true")
+ (condition-case nil
+ (eq 0 (call-process
+ "/bin/sh" nil nil nil
+ "-c"
+ "xprop -root _DT_SAVE_MODE|grep xfce4"))
+ (error nil)))))
+
+(defun report-emacs-bug-insert-to-mailer ()
+ (interactive)
+ (save-excursion
+ (let* ((to (progn
+ (goto-char (point-min))
+ (forward-line)
+ (and (looking-at "^To: \\(.*\\)")
+ (match-string-no-properties 1))))
+ (subject (progn
+ (forward-line)
+ (and (looking-at "^Subject: \\(.*\\)")
+ (match-string-no-properties 1))))
+ (body (progn
+ (forward-line 2)
+ (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))
+ (error "Subject, To or body not found")))))
+
+
;;;###autoload
(defun report-emacs-bug (topic &optional recent-keys)
"Report a bug in GNU Emacs.
@@ -93,6 +139,7 @@
(prompt-properties '(field emacsbug-prompt
intangible but-helpful
rear-nonsticky t))
+ (can-xdg-email (report-emacs-bug-can-use-xdg-email))
user-point message-end-point)
(setq message-end-point
(with-current-buffer (get-buffer-create "*Messages*")
@@ -226,6 +273,9 @@
;; 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
+ (define-key (current-local-map) "\C-cm"
+ 'report-emacs-bug-insert-to-mailer))
;; Could test major-mode instead.
(cond ((memq mail-user-agent '(message-user-agent gnus-user-agent))
(setq report-emacs-bug-send-command "message-send-and-exit"
@@ -245,6 +295,9 @@
report-emacs-bug-send-command))))
(princ (substitute-command-keys
" Type \\[kill-buffer] RET to cancel (don't send it).\n"))
+ (if can-xdg-email
+ (princ (substitute-command-keys
+ " Type \\[report-emacs-bug-insert-to-mailer] to insert
text to you preferred mail program.\n")))
(terpri)
(princ (substitute-command-keys
" Type \\[report-emacs-bug-info] to visit in Info the Emacs
Manual section
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r101106: Add command C-c m in report-emacs-bug that puts the bug into preferred mailer.,
Jan D. <=