emacs-diffs
[Top][All Lists]
Advanced

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

master 4038b4f 2/2: Implement a new `submit-emacs-patch' command


From: Lars Ingebrigtsen
Subject: master 4038b4f 2/2: Implement a new `submit-emacs-patch' command
Date: Wed, 9 Sep 2020 06:59:42 -0400 (EDT)

branch: master
commit 4038b4fee794a85c055ba28b499264045a2cb2dc
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Implement a new `submit-emacs-patch' command
    
    * doc/emacs/trouble.texi (Checklist): Mention the new command.
    
    * doc/lispref/intro.texi (Caveats): Ditto.
    
    * lisp/mail/emacsbug.el (emacs-bug--system-description): Factor
    out into own function.
    (report-emacs-bug): ... from here.
    (submit-emacs-patch): New command.
---
 doc/emacs/trouble.texi | 20 +++++++----
 doc/lispref/intro.texi |  4 ++-
 etc/NEWS               |  5 +++
 lisp/mail/emacsbug.el  | 90 ++++++++++++++++++++++++++++++++++++--------------
 4 files changed, 87 insertions(+), 32 deletions(-)

diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi
index 33f67f2..dbd1a07 100644
--- a/doc/emacs/trouble.texi
+++ b/doc/emacs/trouble.texi
@@ -721,18 +721,24 @@ will be sent to the Emacs maintainers at
 @ifhtml
 @url{https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs, bug-gnu-emacs}.
 @end ifhtml
-(If you want to suggest an improvement or new feature, use the same
-address.)  If you cannot send mail from inside Emacs, you can copy the
+If you cannot send mail from inside Emacs, you can copy the
 text of your report to your normal mail client (if your system
 supports it, you can type @kbd{C-c M-i} to have Emacs do this for you)
 and send it to that address.  Or you can simply send an email to that
 address describing the problem.
 
-Your report will be sent to the @samp{bug-gnu-emacs} mailing list, and
-stored in the GNU Bug Tracker at @url{https://debbugs.gnu.org}.  Please
-include a valid reply email address, in case we need to ask you for
-more information about your report.  Submissions are moderated, so
-there may be a delay before your report appears.
+If you want to submit code to Emacs (to fix a problem or implement a
+new feature), the easiest way to do this is to send a patch to the
+Emacs issue tracker.  This is done with the @kbd{M-x
+submit-emacs-patch} command, and works much the same as when reporting
+bugs.
+
+In any case, your report will be sent to the @samp{bug-gnu-emacs}
+mailing list, and stored in the GNU Bug Tracker at
+@url{https://debbugs.gnu.org}.  Please include a valid reply email
+address, in case we need to ask you for more information about your
+report.  Submissions are moderated, so there may be a delay before
+your report appears.
 
 You do not need to know how the GNU Bug Tracker works in order to
 report a bug, but if you want to, you can read the tracker's online
diff --git a/doc/lispref/intro.texi b/doc/lispref/intro.texi
index 8e4fbc7..254d4e9 100644
--- a/doc/lispref/intro.texi
+++ b/doc/lispref/intro.texi
@@ -87,7 +87,9 @@ you are criticizing.
 
 @cindex bugs
 @cindex suggestions
-Please send comments and corrections using @kbd{M-x report-emacs-bug}.
+Please send comments and corrections using @kbd{M-x
+report-emacs-bug}.  If you wish to contribute new code (or send a
+patch to fix a problem), use @kbd{M-x submit-emacs-patch}).
 
 @node Lisp History
 @section Lisp History
diff --git a/etc/NEWS b/etc/NEWS
index 350ea56..9d26620 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -959,6 +959,11 @@ window after starting).  This variable defaults to nil.
 ** Miscellaneous
 
 +++
+*** New command 'submit-emacs-patch'
+This works along the lines of 'report-emacs-bug', but is more geared
+towards sending a patch to the Emacs issue tracker.
+
++++
 *** New minor mode 'button-mode'.
 This minor mode does nothing else than install 'button-buffer-map' as
 a minor mode map (which binds the TAB/S-TAB key bindings to navigate
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index 6b9e1db..5d1da08 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -305,30 +305,7 @@ usually do not have translators for other 
languages.\n\n")))
     (let ((txt (delete-and-extract-region (1+ user-point) (point))))
       (insert (propertize "\n" 'display txt)))
 
-    (insert "\nIn " (emacs-version))
-    (if emacs-build-system
-        (insert " built on " emacs-build-system))
-    (insert "\n")
-
-    (if (stringp emacs-repository-version)
-       (insert "Repository revision: " emacs-repository-version "\n"))
-    (if (stringp emacs-repository-branch)
-       (insert "Repository branch: " emacs-repository-branch "\n"))
-    (if (fboundp 'x-server-vendor)
-       (condition-case nil
-            ;; This is used not only for X11 but also W32 and others.
-           (insert "Windowing system distributor '" (x-server-vendor)
-                    "', version "
-                   (mapconcat 'number-to-string (x-server-version) ".") "\n")
-         (error t)))
-    (let ((os (ignore-errors (report-emacs-bug--os-description))))
-      (if (stringp os)
-          (insert "System Description: " os "\n\n")))
-    (when (and system-configuration-options
-              (not (equal system-configuration-options "")))
-      (insert "Configured using:\n 'configure "
-             system-configuration-options "'\n\n")
-      (fill-region (line-beginning-position -1) (point)))
+    (emacs-bug--system-description)
     (insert "Configured features:\n" system-configuration-features "\n\n")
     (fill-region (line-beginning-position -1) (point))
     (insert "Important settings:\n")
@@ -409,6 +386,32 @@ usually do not have translators for other 
languages.\n\n")))
           (buffer-substring-no-properties (point-min) (point)))
     (goto-char user-point)))
 
+(defun emacs-bug--system-description ()
+  (insert "\nIn " (emacs-version))
+  (if emacs-build-system
+      (insert " built on " emacs-build-system))
+  (insert "\n")
+
+  (if (stringp emacs-repository-version)
+      (insert "Repository revision: " emacs-repository-version "\n"))
+  (if (stringp emacs-repository-branch)
+      (insert "Repository branch: " emacs-repository-branch "\n"))
+  (if (fboundp 'x-server-vendor)
+      (condition-case nil
+          ;; This is used not only for X11 but also W32 and others.
+         (insert "Windowing system distributor '" (x-server-vendor)
+                  "', version "
+                 (mapconcat 'number-to-string (x-server-version) ".") "\n")
+       (error t)))
+  (let ((os (ignore-errors (report-emacs-bug--os-description))))
+    (if (stringp os)
+        (insert "System Description: " os "\n\n")))
+  (when (and system-configuration-options
+            (not (equal system-configuration-options "")))
+    (insert "Configured using:\n 'configure "
+           system-configuration-options "'\n\n")
+    (fill-region (line-beginning-position -1) (point))))
+
 (define-obsolete-function-alias 'report-emacs-bug-info 'info-emacs-bug "24.3")
 
 (defun report-emacs-bug-hook ()
@@ -475,6 +478,45 @@ and send the mail again%s."
       (when (get-buffer-window help)
         (quit-window nil (get-buffer-window help))))))
 
+;;;###autoload
+(defun submit-emacs-patch (subject file)
+  "Send an Emacs patch to the Emacs maintainers.
+Interactively, you will be prompted for SUBJECT and a patch FILE
+name (which will be attached to the mail).  You will end up in a
+Message buffer where you can explain more about the patch."
+  (interactive "sThis patch is about: \nfPatch file name: ")
+  (switch-to-buffer "*Patch Help*")
+  (let ((inhibit-read-only t))
+    (erase-buffer)
+    (insert "Thank you for considering submitting a patch to the Emacs 
project.\n\n"
+            "Please describe what the patch fixes (or, if it's a new feature, 
what it\n"
+            "implements) in the mail buffer below.  When done, use the `C-c 
C-c' command\n"
+            "to send the patch as an email to the Emacs issue tracker.\n\n"
+            "If this is the first time you've submitted an Emacs patch, 
please\n"
+            "read the ")
+    (insert-text-button
+     "CONTRIBUTE"
+     'action (lambda (_)
+               (view-buffer
+                (find-file-noselect
+                 (expand-file-name "CONTRIBUTE" installation-directory)))))
+    (insert " file first.\n")
+    (goto-char (point-min))
+    (view-mode 1)
+    (button-mode 1))
+  (message-mail-other-window report-emacs-bug-address subject)
+  (insert "\n\n\n")
+  (emacs-bug--system-description)
+  (mml-attach-file file "text/patch" nil "attachment")
+  (message-goto-body)
+  (message "Write a description of the patch and use `C-c C-c' to send it")
+  (message-add-action
+   (lambda ()
+     ;; Bury the help buffer (if it's shown).
+     (when-let ((help (get-buffer "*Patch Help*")))
+       (when (get-buffer-window help)
+         (quit-window nil (get-buffer-window help)))))
+   'send))
 
 (provide 'emacsbug)
 



reply via email to

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