1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-29 07:58:28 +00:00

Fix command substitution in emacsbug.el

* lisp/mail/emacsbug.el: Minor doc fix.
(submit-emacs-patch, report-emacs-bug): Fix command substitution.
Prefer keymap-set to define-key.
This commit is contained in:
Stefan Kangas 2022-06-17 15:54:29 +02:00
parent 488a4cd61b
commit af8ec14cd7

View File

@ -1,7 +1,6 @@
;;; emacsbug.el --- command to report Emacs bugs to appropriate mailing list -*- lexical-binding: t; -*- ;;; emacsbug.el --- command to report Emacs bugs to appropriate mailing list -*- lexical-binding: t; -*-
;; Copyright (C) 1985, 1994, 1997-1998, 2000-2022 Free Software ;; Copyright (C) 1985-2022 Free Software Foundation, Inc.
;; Foundation, Inc.
;; Author: K. Shane Hartman ;; Author: K. Shane Hartman
;; Maintainer: emacs-devel@gnu.org ;; Maintainer: emacs-devel@gnu.org
@ -30,6 +29,9 @@
;; to complete the process. Alternatively, compose the bug report in ;; to complete the process. Alternatively, compose the bug report in
;; Emacs then paste it into your normal mail client. ;; Emacs then paste it into your normal mail client.
;; `M-x submit-emacs-patch' can be used to send a patch to the Emacs
;; maintainers.
;;; Code: ;;; Code:
(require 'sendmail) (require 'sendmail)
@ -348,10 +350,10 @@ usually do not have translators for other languages.\n\n")))
;; This is so the user has to type something in order to send easily. ;; This is so the user has to type something in order to send easily.
(use-local-map (nconc (make-sparse-keymap) (current-local-map))) (use-local-map (nconc (make-sparse-keymap) (current-local-map)))
(define-key (current-local-map) "\C-c\C-i" #'info-emacs-bug) (keymap-set (current-local-map) "C-c C-i" #'info-emacs-bug)
(if can-insert-mail (if can-insert-mail
(define-key (current-local-map) "\C-c\M-i" (keymap-set (current-local-map) "C-c M-i"
#'report-emacs-bug-insert-to-mailer)) #'report-emacs-bug-insert-to-mailer))
(setq report-emacs-bug-send-command (get mail-user-agent 'sendfunc) (setq report-emacs-bug-send-command (get mail-user-agent 'sendfunc)
report-emacs-bug-send-hook (get mail-user-agent 'hookvar)) report-emacs-bug-send-hook (get mail-user-agent 'hookvar))
(if report-emacs-bug-send-command (if report-emacs-bug-send-command
@ -360,20 +362,23 @@ usually do not have translators for other languages.\n\n")))
(unless report-emacs-bug-no-explanations (unless report-emacs-bug-no-explanations
(with-output-to-temp-buffer "*Bug Help*" (with-output-to-temp-buffer "*Bug Help*"
(princ "While in the mail buffer:\n\n") (princ "While in the mail buffer:\n\n")
(if report-emacs-bug-send-command (let ((help
(princ (substitute-command-keys (substitute-command-keys
(format " Type \\[%s] to send the bug report.\n" (format "%s%s%s%s"
report-emacs-bug-send-command)))) (if report-emacs-bug-send-command
(princ (substitute-command-keys (format " Type \\[%s] to send the bug report.\n"
" Type \\[kill-buffer] RET to cancel (don't send it).\n")) report-emacs-bug-send-command)
(if can-insert-mail "")
(princ (substitute-command-keys " Type \\[kill-buffer] \\`RET' to cancel (don't send it).\n"
" Type \\[report-emacs-bug-insert-to-mailer] to copy text to your preferred mail program.\n"))) (if can-insert-mail
(terpri) " Type \\[report-emacs-bug-insert-to-mailer] to \
(princ (substitute-command-keys copy text to your preferred mail program.\n"
" Type \\[info-emacs-bug] to visit in Info the Emacs Manual section "")
" Type \\[info-emacs-bug] to visit in Info the Emacs Manual section
about when and how to write a bug report, and what about when and how to write a bug report, and what
information you should include to help fix the bug."))) information you should include to help fix the bug."))))
(with-current-buffer "*Bug Help*"
(insert help))))
(shrink-window-if-larger-than-buffer (get-buffer-window "*Bug Help*"))) (shrink-window-if-larger-than-buffer (get-buffer-window "*Bug Help*")))
;; Make it less likely people will send empty messages. ;; Make it less likely people will send empty messages.
(if report-emacs-bug-send-hook (if report-emacs-bug-send-hook
@ -501,9 +506,10 @@ Message buffer where you can explain more about the patch."
(erase-buffer) (erase-buffer)
(insert "Thank you for considering submitting a patch to the Emacs project.\n\n" (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" "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" "implements) in the mail buffer below. When done, use the "
(substitute-command-keys "\\<message-mode-map>\\[message-send-and-exit] command\n")
"to send the patch as an email to the Emacs issue tracker.\n\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" "If this is the first time you're submitting an Emacs patch, please\n"
"read the ") "read the ")
(insert-text-button (insert-text-button
"CONTRIBUTE" "CONTRIBUTE"
@ -521,7 +527,8 @@ Message buffer where you can explain more about the patch."
(emacs-bug--system-description) (emacs-bug--system-description)
(mml-attach-file file "text/patch" nil "attachment") (mml-attach-file file "text/patch" nil "attachment")
(message-goto-body) (message-goto-body)
(message "Write a description of the patch and use `C-c C-c' to send it") (message "Write a description of the patch and use %s to send it"
(substitute-command-keys "\\[message-send-and-exit]"))
(add-hook 'message-send-hook (add-hook 'message-send-hook
(lambda () (lambda ()
(message-goto-body) (message-goto-body)