diff options
| author | Paul Eggert | 2019-03-26 19:06:36 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-03-26 19:07:21 -0700 |
| commit | 5d6a314475704f3fbdb29f68c6929516230e8a98 (patch) | |
| tree | ad00278e70192b7bfb072b436a0aa607ed20a9a9 /lisp/mail | |
| parent | c8ec3108a3d0bd1955d21f40b3c0c3b36d55b20d (diff) | |
| download | emacs-5d6a314475704f3fbdb29f68c6929516230e8a98.tar.gz emacs-5d6a314475704f3fbdb29f68c6929516230e8a98.zip | |
2019-03-26 regex cleanup
Problems reported by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2019-03/msg01028.html
* lisp/align.el (align-rules-list):
* lisp/speedbar.el (speedbar-check-read-only, speedbar-check-vc):
* lisp/vc/diff-mode.el (diff-add-change-log-entries-other-window):
* lisp/woman.el (woman-parse-numeric-arg):
Put "-" at end of character alternatives, since a range was not intended.
* lisp/erc/erc.el (font-lock):
* lisp/mail/footnote.el (cl-seq):
Avoid duplicate character alternatives by using cl-seq API.
* lisp/mail/footnote.el (footnote--current-regexp):
* lisp/textmodes/css-mode.el (css--font-lock-keywords):
Avoid repetition of repetition.
* lisp/net/webjump.el (webjump-url-encode):
Add ~ to character alternatives, and rewrite confusing range.
* lisp/progmodes/verilog-mode.el (verilog-compiler-directives)
(verilog-assignment-operator-re):
Remove duplicate.
* lisp/progmodes/verilog-mode.el (verilog-preprocessor-re):
* lisp/textmodes/css-mode.el (css--font-lock-keywords):
Don’t escape a char that doesn’t need it.
* lisp/textmodes/picture.el (picture-tab-chars): In docstring,
do not say regexp characters will be quoted; merely say in
another way that the syntax is that of character alternatives.
(picture-set-tab-stops, picture-tab-search): Don’t attempt
to regexp-quote picture-tab-chars.
(picture-tab-search): Quote \ in picture-tab-chars for
skip-chars-backwards, which treats \ differently than
regexp character alternatives do.
Diffstat (limited to 'lisp/mail')
| -rw-r--r-- | lisp/mail/footnote.el | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el index a7802929dca..7f88e30120d 100644 --- a/lisp/mail/footnote.el +++ b/lisp/mail/footnote.el | |||
| @@ -64,6 +64,7 @@ | |||
| 64 | ;;; Code: | 64 | ;;; Code: |
| 65 | 65 | ||
| 66 | (eval-when-compile (require 'cl-lib)) | 66 | (eval-when-compile (require 'cl-lib)) |
| 67 | (require 'cl-seq) | ||
| 67 | (defvar filladapt-token-table) | 68 | (defvar filladapt-token-table) |
| 68 | 69 | ||
| 69 | (defgroup footnote nil | 70 | (defgroup footnote nil |
| @@ -363,7 +364,9 @@ Use Unicode characters for footnoting." | |||
| 363 | ("ק" "ר" "ש" "ת" "תק" "תר" "תש" "תת" "תתק"))) | 364 | ("ק" "ר" "ש" "ת" "תק" "תר" "תש" "תת" "תתק"))) |
| 364 | 365 | ||
| 365 | (defconst footnote-hebrew-numeric-regex | 366 | (defconst footnote-hebrew-numeric-regex |
| 366 | (concat "[" (apply #'concat (apply #'append footnote-hebrew-numeric)) "']+")) | 367 | (concat "[" (cl-delete-duplicates |
| 368 | (apply #'concat (apply #'append footnote-hebrew-numeric))) | ||
| 369 | "']+")) | ||
| 367 | ;; (defconst footnote-hebrew-numeric-regex "\\([אבגדהוזחט]'\\)?\\(ת\\)?\\(ת\\)?\\([קרשת]\\)?\\([טיכלמנסעפצ]\\)?\\([אבגדהוזחט]\\)?") | 370 | ;; (defconst footnote-hebrew-numeric-regex "\\([אבגדהוזחט]'\\)?\\(ת\\)?\\(ת\\)?\\([קרשת]\\)?\\([טיכלמנסעפצ]\\)?\\([אבגדהוזחט]\\)?") |
| 368 | 371 | ||
| 369 | (defun footnote--hebrew-numeric (n) | 372 | (defun footnote--hebrew-numeric (n) |
| @@ -457,9 +460,14 @@ Conversion is done based upon the current selected style." | |||
| 457 | 460 | ||
| 458 | (defun footnote--current-regexp () | 461 | (defun footnote--current-regexp () |
| 459 | "Return the regexp of the index of the current style." | 462 | "Return the regexp of the index of the current style." |
| 460 | (concat (nth 2 (or (assq footnote-style footnote-style-alist) | 463 | (let ((regexp (nth 2 (or (assq footnote-style footnote-style-alist) |
| 461 | (nth 0 footnote-style-alist))) | 464 | (nth 0 footnote-style-alist))))) |
| 462 | "*")) | 465 | (concat |
| 466 | ;; Hack to avoid repetition of repetition. | ||
| 467 | (if (string-match "[^\\]\\\\\\{2\\}*[*+?]\\'" regexp) | ||
| 468 | (substring regexp 0 -1) | ||
| 469 | regexp) | ||
| 470 | "*"))) | ||
| 463 | 471 | ||
| 464 | (defun footnote--refresh-footnotes (&optional index-regexp) | 472 | (defun footnote--refresh-footnotes (&optional index-regexp) |
| 465 | "Redraw all footnotes. | 473 | "Redraw all footnotes. |