From: Glenn Morris Date: Sat, 20 Apr 2019 18:38:47 +0000 (-0700) Subject: Add a package: line to c-submit-bug-report. X-Git-Tag: emacs-26.2.90~89^2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cd2204f0ee018ef29c2d8536b7e6d41dc9b10052;p=emacs.git Add a package: line to c-submit-bug-report. * lisp/progmodes/cc-mode.el (c-submit-bug-report): Add a Package: line for mail clients that do not support X- headers. --- diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 5283cfea6eb..aa2a286dbe9 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -2220,6 +2220,7 @@ Key bindings: ;; reporter-submit-bug-report requires sendmail. (declare-function mail-position-on-field "sendmail" (field &optional soft)) +(declare-function mail-text "sendmail" ()) (defun c-submit-bug-report () "Submit via mail a bug report on CC Mode." @@ -2284,9 +2285,26 @@ Key bindings: vars) (lambda () (run-hooks 'c-prepare-bug-report-hook) + (let ((hook (get mail-user-agent 'hookvar))) + (if hook + (add-hook hook + (lambda () + (save-excursion + (mail-text) + (unless (looking-at "Package: ") + (insert "Package: " c-mode-bug-package "\n\n")))) + nil t))) (save-excursion (or (mail-position-on-field "X-Debbugs-Package") - (insert c-mode-bug-package))) + (insert c-mode-bug-package)) + ;; For mail clients that do not support X- headers. + ;; Sadly reporter-submit-bug-report unconditionally adds + ;; a blank line before SALUTATION, so we can't use that. + ;; It is also sad that reporter offers no way to leave point + ;; after this line we are now inserting. + (mail-text) + (or (looking-at "Package:") + (insert "Package: " c-mode-bug-package))) (insert (format "Buffer Style: %s\nc-emacs-features: %s\n" style c-features)))))))