summaryrefslogtreecommitdiff
path: root/lisp/mail
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-03-27 11:36:13 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-03-27 11:37:47 -0700
commit92acab73e0dd3921b53eac4f3fba327b7aa4d3aa (patch)
treed853281b0ef547f99b74994bb70caecac9a3f778 /lisp/mail
parenta35a1f6a9406bc98b4ab83489e5dc7843ffacfb6 (diff)
downloademacs-92acab73e0dd3921b53eac4f3fba327b7aa4d3aa.tar.gz
Use regexp-opt-charset to improve regexp tweaks
* lisp/emacs-lisp/regexp-opt.el (regexp-opt): Reword confusing sentence in doc string. * lisp/erc/erc.el (erc-lurker-maybe-trim): * lisp/mail/footnote.el (footnote-hebrew-numeric-regex): Improve by using regexp-opt-charset.
Diffstat (limited to 'lisp/mail')
-rw-r--r--lisp/mail/footnote.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el
index 7f88e30120d..81dc11de763 100644
--- a/lisp/mail/footnote.el
+++ b/lisp/mail/footnote.el
@@ -64,7 +64,6 @@
;;; Code:
(eval-when-compile (require 'cl-lib))
-(require 'cl-seq)
(defvar filladapt-token-table)
(defgroup footnote nil
@@ -364,9 +363,9 @@ Use Unicode characters for footnoting."
("ק" "ר" "ש" "ת" "תק" "תר" "תש" "תת" "תתק")))
(defconst footnote-hebrew-numeric-regex
- (concat "[" (cl-delete-duplicates
- (apply #'concat (apply #'append footnote-hebrew-numeric)))
- "']+"))
+ (let ((numchars (string-to-list
+ (apply #'concat (apply #'append footnote-hebrew-numeric)))))
+ (concat (regexp-opt-charset (cons ?' numchars)) "+")))
;; (defconst footnote-hebrew-numeric-regex "\\([אבגדהוזחט]'\\)?\\(ת\\)?\\(ת\\)?\\([קרשת]\\)?\\([טיכלמנסעפצ]\\)?\\([אבגדהוזחט]\\)?")
(defun footnote--hebrew-numeric (n)
@@ -464,6 +463,11 @@ Conversion is done based upon the current selected style."
(nth 0 footnote-style-alist)))))
(concat
;; Hack to avoid repetition of repetition.
+ ;; FIXME: I'm not sure the added * makes sense at all; there is
+ ;; always a single number within the footnote-{start,end}-tag pairs.
+ ;; Worse, the code goes on and adds yet another + later on, in
+ ;; footnote-refresh-footnotes, just in case. That makes even less sense.
+ ;; Likely, both the * and the extra + should go away.
(if (string-match "[^\\]\\\\\\{2\\}*[*+?]\\'" regexp)
(substring regexp 0 -1)
regexp)