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.
This commit is contained in:
Lars Ingebrigtsen 2020-09-09 12:59:23 +02:00
parent 1ee76735a2
commit 4038b4fee7
4 changed files with 87 additions and 32 deletions

View file

@ -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

View file

@ -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

View file

@ -958,6 +958,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

View file

@ -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)