From c61d2587bbfc1692971b3144716ab5f01b09231f Mon Sep 17 00:00:00 2001 From: Antero Mejr Date: Mon, 23 Jun 2025 21:48:44 +0000 Subject: [PATCH] Check for text about Org-mode when submitting emacs bugs * lisp/mail/emacsbug.el (report-emacs-bug-hook): Add regex check for references to Org, and warn user if matches are found. (Bug#78823) --- lisp/mail/emacsbug.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index ad6f1b7a58b..5ffb86e68b6 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -424,6 +424,20 @@ copy text to your preferred mail program.\n" system-configuration-options "'\n\n") (fill-region (line-beginning-position -1) (point)))) +(defun report-emacs-bug-check-org () + "Warn the user if the bug report mentions org-mode." + (unless report-emacs-bug-no-confirmation + (goto-char (point-max)) + (skip-chars-backward " \t\n") + (let* ((text (buffer-substring-no-properties (point-min) (point))) + (l (length report-emacs-bug-orig-text)) + (text (substring text 0 l)) + (org-regex "\\b[Oo]rg\\(-mode\\)?\\b")) + (when (string-match-p org-regex text) + (when (yes-or-no-p "Is this bug about org-mode?") + (error (substitute-command-keys "\ +Not sending, use \\[org-submit-bug-report] to report an Org-mode bug."))))))) + (defun report-emacs-bug-hook () "Do some checking before sending a bug report." (goto-char (point-max)) @@ -493,6 +507,7 @@ and send the mail again%s." (goto-char (point-min)) (re-search-forward "^From: " nil t) (error "Please edit the From address and try again")))) + (report-emacs-bug-check-org) ;; Bury the help buffer (if it's shown). (when-let* ((help (get-buffer "*Bug Help*"))) (when (get-buffer-window help)