emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 cd2204f: Add a package: line to c-submit-bug-repo


From: Glenn Morris
Subject: [Emacs-diffs] emacs-26 cd2204f: Add a package: line to c-submit-bug-report.
Date: Sat, 20 Apr 2019 14:38:59 -0400 (EDT)

branch: emacs-26
commit cd2204f0ee018ef29c2d8536b7e6d41dc9b10052
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    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.
---
 lisp/progmodes/cc-mode.el | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 5283cfe..aa2a286 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)))))))
 



reply via email to

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