diff options
| author | Juri Linkov <juri@linkov.net> | 2019-06-03 23:18:31 +0300 |
|---|---|---|
| committer | Juri Linkov <juri@linkov.net> | 2019-06-03 23:18:31 +0300 |
| commit | 9d72d6a3a2fb23c6f7123c5aba2457dee93d9454 (patch) | |
| tree | 0f2bae3eed0da6ac668a6cae9ee2c7e749937e45 /lisp/char-fold.el | |
| parent | 4b87a032dcaebad3ba37cdb3cb0cdd2760fc24fd (diff) | |
| download | emacs-9d72d6a3a2fb23c6f7123c5aba2457dee93d9454.tar.gz | |
* lisp/char-fold.el (char-fold-make-table): New function
with body extracted from INITVALUE of defconst (bug#35689).
Bind search-spaces-regexp to nil (bug#35802).
* test/lisp/char-fold-tests.el: Relocate helpers to file beginning.
(char-fold--test-bug-35802): New test.
Diffstat (limited to 'lisp/char-fold.el')
| -rw-r--r-- | lisp/char-fold.el | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lisp/char-fold.el b/lisp/char-fold.el index e61bc3edc6a..d2fa7108bbd 100644 --- a/lisp/char-fold.el +++ b/lisp/char-fold.el @@ -24,11 +24,12 @@ (eval-and-compile (put 'char-fold-table 'char-table-extra-slots 1)) -(defconst char-fold-table - (eval-when-compile - (let ((equiv (make-char-table 'char-fold-table)) - (equiv-multi (make-char-table 'char-fold-table)) - (table (unicode-property-table-internal 'decomposition))) +(eval-and-compile + (defun char-fold-make-table () + (let* ((equiv (make-char-table 'char-fold-table)) + (equiv-multi (make-char-table 'char-fold-table)) + (search-spaces-regexp nil) ; workaround for bug#35802 + (table (unicode-property-table-internal 'decomposition))) (set-char-table-extra-slot equiv 0 equiv-multi) ;; Ensure the table is populated. @@ -107,13 +108,17 @@ ;; Convert the lists of characters we compiled into regexps. (map-char-table - (lambda (char dec-list) - (let ((re (regexp-opt (cons (char-to-string char) dec-list)))) - (if (consp char) + (lambda (char decomp-list) + (let ((re (regexp-opt (cons (char-to-string char) decomp-list)))) + (if (consp char) ; FIXME: char never is consp? (set-char-table-range equiv char re) (aset equiv char re)))) equiv) - equiv)) + equiv))) + +(defconst char-fold-table + (eval-when-compile + (char-fold-make-table)) "Used for folding characters of the same group during search. This is a char-table with the `char-fold-table' subtype. |
