]> git.eshelyaron.com Git - emacs.git/commitdiff
Simplify regexp in make-news-html-file
authorStefan Kangas <stefankangas@gmail.com>
Sat, 17 Sep 2022 00:13:05 +0000 (02:13 +0200)
committerStefan Kangas <stefankangas@gmail.com>
Sat, 17 Sep 2022 00:18:27 +0000 (02:18 +0200)
* admin/admin.el (make-news-html-file): Simplify regexp.
Suggested by Mattias EngdegĂ„rd <mattiase@acm.org>.

admin/admin.el

index 4727dd08e6f4a59fd87af3aa35a8b242110814bd..3906dd8d63c52ce2d6c819abad808415140ec6a2 100644 (file)
@@ -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"))
-                     ;; "<return>" and "<remap> <foo>"
-                     (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)