From 5dbe4fa64abe9e9991e060ecd61f34e675b1bf8a Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 17 Sep 2022 02:13:05 +0200 Subject: [PATCH] Simplify regexp in make-news-html-file MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * admin/admin.el (make-news-html-file): Simplify regexp. Suggested by Mattias Engdegård . --- admin/admin.el | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/admin/admin.el b/admin/admin.el index 4727dd08e6f..3906dd8d63c 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -883,30 +883,17 @@ $Date: %s $ ;; Use Org-mode markers for 'symbols', 'C-x k', etc. (replace-regexp-in-region - (rx-let ((key (seq - ;; Modifier (optional) - (? (any "ACHMSs") "-") - (or - ;; single key - (not (any " \n")) - ;; "" and " " - (seq "<" - (+ (any "A-Za-z-")) - (+ (seq " " (+ (any "A-Za-z-")))) - ">") - "NUL" "RET" "LFD" "TAB" - "ESC" "SPC" "DEL"))) - (email (seq (+ (not (any " @\n"))) - "@" - (+ (not (any " @\n"))))) - (lisp-symbol (regexp lisp-mode-symbol-regexp))) - (rx "'" (group - (or lisp-symbol - email - (seq "M-x " lisp-symbol) - (seq key (+ " " key)))) - "'")) - "~\\1~" (point-min) (point-max)) + (rx (or (: (group (in " \t\n(")) + "'" + (group (+ (or (not (in "'\n")) + (: "'" (not (in " .,\t\n)")))))) + "'" + (group (in ",.;:!? \t\n)"))) + ;; Buffer names, e.g. "*scratch*". + (: "\"" + (group-n 2 "*" (+ (not (in "*\""))) "*") + "\""))) + "\\1~\\2~\\3" (point-min) (point-max)) ;; Format code blocks. (while (re-search-forward "^ " nil t) -- 2.39.2