diff options
author | Glenn Morris <rgm@gnu.org> | 2019-04-20 11:38:47 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2019-04-20 11:38:47 -0700 |
commit | cd2204f0ee018ef29c2d8536b7e6d41dc9b10052 (patch) | |
tree | 1ecb05c0571084d8a7a6175eb2cd11a87bbaeb58 /lisp | |
parent | a992dcabc718dc87de6b80669cff18b09e71c5e7 (diff) | |
download | emacs-cd2204f0ee018ef29c2d8536b7e6d41dc9b10052.tar.gz |
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.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/progmodes/cc-mode.el | 20 |
1 files changed, 19 insertions, 1 deletions
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))))))) |