Function: report-emacs-bug-insert-to-mailer
report-emacs-bug-insert-to-mailer is an interactive and byte-compiled
function defined in emacsbug.el.gz.
Signature
(report-emacs-bug-insert-to-mailer)
Documentation
Send the message to your preferred mail client.
This requires either the macOS "open" command, or the freedesktop
"xdg-email" command to be available.
Probably introduced at or before Emacs version 24.3.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/mail/emacsbug.el.gz
(defun report-emacs-bug-insert-to-mailer ()
"Send the message to your preferred mail client.
This requires either the macOS \"open\" command, or the freedesktop
\"xdg-email\" command to be available."
(interactive)
(save-excursion
;; FIXME? use mail-fetch-field?
(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)
(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")))))