diff options
| author | Artur Malabarba | 2015-11-29 20:42:02 +0000 |
|---|---|---|
| committer | Artur Malabarba | 2015-11-29 20:42:25 +0000 |
| commit | 285ed41605ca44794dd7fd16abf63eb3f8808238 (patch) | |
| tree | b3a3ec7cec1ade26df247bfdb6d7ee47e1dbe306 | |
| parent | 4c6f368c3dcff674ff1891107abd7b54e92cf4cb (diff) | |
| download | emacs-285ed41605ca44794dd7fd16abf63eb3f8808238.tar.gz emacs-285ed41605ca44794dd7fd16abf63eb3f8808238.zip | |
* lisp/character-fold.el (character-fold-to-regexp): Be careful
not to return huge regexps.
| -rw-r--r-- | lisp/character-fold.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/character-fold.el b/lisp/character-fold.el index c2b9a0729e6..88622b32a7d 100644 --- a/lisp/character-fold.el +++ b/lisp/character-fold.el | |||
| @@ -150,9 +150,8 @@ Any character in STRING that has an entry in | |||
| 150 | `character-fold-table' is replaced with that entry (which is a | 150 | `character-fold-table' is replaced with that entry (which is a |
| 151 | regexp) and other characters are `regexp-quote'd. | 151 | regexp) and other characters are `regexp-quote'd. |
| 152 | 152 | ||
| 153 | Note that this function can potentially return regexps too long | 153 | If the resulting regexp would be too long for Emacs to handle, |
| 154 | for Emacs to handle. If STRING is longer than 30 characters, | 154 | just return the result of calling `regexp-quote' on STRING. |
| 155 | consider not using this function. | ||
| 156 | 155 | ||
| 157 | FROM is for internal use. It specifies an index in the STRING | 156 | FROM is for internal use. It specifies an index in the STRING |
| 158 | from which to start." | 157 | from which to start." |
| @@ -222,7 +221,11 @@ from which to start." | |||
| 222 | (setq i (1+ i))) | 221 | (setq i (1+ i))) |
| 223 | (when (> spaces 0) | 222 | (when (> spaces 0) |
| 224 | (push (character-fold--make-space-string spaces) out)) | 223 | (push (character-fold--make-space-string spaces) out)) |
| 225 | (apply #'concat (nreverse out)))) | 224 | (let ((regexp (apply #'concat (nreverse out)))) |
| 225 | ;; Limited by `MAX_BUF_SIZE' in `regex.c'. | ||
| 226 | (if (> (length regexp) 32000) | ||
| 227 | (regexp-quote string) | ||
| 228 | regexp)))) | ||
| 226 | 229 | ||
| 227 | 230 | ||
| 228 | ;;; Commands provided for completeness. | 231 | ;;; Commands provided for completeness. |