Simplify regexp in make-news-html-file

* admin/admin.el (make-news-html-file): Simplify regexp.
Suggested by Mattias Engdegård <mattiase@acm.org>.
This commit is contained in:
Stefan Kangas 2022-09-17 02:13:05 +02:00
parent 069ffbda09
commit 5dbe4fa64a

View file

@ -883,30 +883,17 @@ $Date: %s $
;; Use Org-mode markers for 'symbols', 'C-x k', etc. ;; Use Org-mode markers for 'symbols', 'C-x k', etc.
(replace-regexp-in-region (replace-regexp-in-region
(rx-let ((key (seq (rx (or (: (group (in " \t\n("))
;; Modifier (optional) "'"
(? (any "ACHMSs") "-") (group (+ (or (not (in "'\n"))
(or (: "'" (not (in " .,\t\n)"))))))
;; single key "'"
(not (any " \n")) (group (in ",.;:!? \t\n)")))
;; "<return>" and "<remap> <foo>" ;; Buffer names, e.g. "*scratch*".
(seq "<" (: "\""
(+ (any "A-Za-z-")) (group-n 2 "*" (+ (not (in "*\""))) "*")
(+ (seq " " (+ (any "A-Za-z-")))) "\"")))
">") "\\1~\\2~\\3" (point-min) (point-max))
"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))
;; Format code blocks. ;; Format code blocks.
(while (re-search-forward "^ " nil t) (while (re-search-forward "^ " nil t)