aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Malabarba2015-11-30 15:05:44 +0000
committerArtur Malabarba2015-11-30 15:05:58 +0000
commit0d576434a8fdbe32e0bc984b21fc20403acff812 (patch)
tree486b837bd0c2897d29c9fa6c9a8da083ef55cb33
parent36649e0150fa7be91040b9d74009ccc085f8a363 (diff)
downloademacs-0d576434a8fdbe32e0bc984b21fc20403acff812.tar.gz
emacs-0d576434a8fdbe32e0bc984b21fc20403acff812.zip
* lisp/character-fold.el: Comment out branching code
(character-fold-to-regexp): Comment out code that uses multi-char table. The branching caused by this induces absurdly long regexps, up to 10k chars for as little as 25 input characters.
-rw-r--r--lisp/character-fold.el28
1 files changed, 14 insertions, 14 deletions
diff --git a/lisp/character-fold.el b/lisp/character-fold.el
index 88622b32a7d..07537d88ad5 100644
--- a/lisp/character-fold.el
+++ b/lisp/character-fold.el
@@ -180,19 +180,19 @@ from which to start."
180 (regexp-quote (string c)))) 180 (regexp-quote (string c))))
181 (alist nil)) 181 (alist nil))
182 ;; Long string. The regexp would probably be too long. 182 ;; Long string. The regexp would probably be too long.
183 (unless (> end 50) 183 ;; (unless (> end 50)
184 (setq alist (aref multi-char-table c)) 184 ;; (setq alist (aref multi-char-table c))
185 (when case-fold-search 185 ;; (when case-fold-search
186 (let ((other-c (aref lower-case-table c))) 186 ;; (let ((other-c (aref lower-case-table c)))
187 (when (or (not other-c) 187 ;; (when (or (not other-c)
188 (eq other-c c)) 188 ;; (eq other-c c))
189 (setq other-c (aref upper-case-table c))) 189 ;; (setq other-c (aref upper-case-table c)))
190 (when other-c 190 ;; (when other-c
191 (setq alist (append alist (aref multi-char-table other-c))) 191 ;; (setq alist (append alist (aref multi-char-table other-c)))
192 (setq regexp (concat "\\(?:" regexp "\\|" 192 ;; (setq regexp (concat "\\(?:" regexp "\\|"
193 (or (aref character-fold-table other-c) 193 ;; (or (aref character-fold-table other-c)
194 (regexp-quote (string other-c))) 194 ;; (regexp-quote (string other-c)))
195 "\\)")))))) 195 ;; "\\)"))))))
196 (push (let ((alist-out '("\\)"))) 196 (push (let ((alist-out '("\\)")))
197 (pcase-dolist (`(,suffix . ,out-regexp) alist) 197 (pcase-dolist (`(,suffix . ,out-regexp) alist)
198 (let ((len-suf (length suffix))) 198 (let ((len-suf (length suffix)))
@@ -223,7 +223,7 @@ from which to start."
223 (push (character-fold--make-space-string spaces) out)) 223 (push (character-fold--make-space-string spaces) out))
224 (let ((regexp (apply #'concat (nreverse out)))) 224 (let ((regexp (apply #'concat (nreverse out))))
225 ;; Limited by `MAX_BUF_SIZE' in `regex.c'. 225 ;; Limited by `MAX_BUF_SIZE' in `regex.c'.
226 (if (> (length regexp) 32000) 226 (if (> (length regexp) 10000)
227 (regexp-quote string) 227 (regexp-quote string)
228 regexp)))) 228 regexp))))
229 229