1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

; use modern sort calls in more places

* lisp/emacs-lisp/regexp-opt.el (regexp-opt, regexp-opt-group):
* lisp/emacs-lisp/rx.el (rx--parse-any): New-style calls, also faster.
This commit is contained in:
Mattias Engdegård 2025-08-29 16:24:02 +02:00
parent 8d3554683f
commit 8c71ef0f8e
2 changed files with 3 additions and 3 deletions

View file

@ -140,7 +140,7 @@ usually more efficient than that of a simplified version:
(open (cond ((stringp paren) paren) (paren "\\(")))
(re (if strings
(regexp-opt-group
(delete-dups (sort (copy-sequence strings) 'string-lessp))
(delete-dups (sort strings))
(or open t) (not open))
;; No strings: return an unmatchable regexp.
(concat (or open "\\(?:") regexp-unmatchable "\\)"))))
@ -250,7 +250,7 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
(prefixes
;; Sorting is necessary in cases such as ("ad" "d").
(sort (mapcar (lambda (s) (substring s 0 n)) strings)
'string-lessp)))
:in-place t)))
(concat open-group
(regexp-opt-group prefixes t t)
(regexp-quote (nreverse xiffus))