aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/char-fold.el1
-rw-r--r--lisp/info.el4
-rw-r--r--lisp/isearch.el44
-rw-r--r--src/search.c4
-rw-r--r--test/lisp/char-fold-tests.el8
5 files changed, 32 insertions, 29 deletions
diff --git a/lisp/char-fold.el b/lisp/char-fold.el
index d2fa7108bbd..7223ecf738c 100644
--- a/lisp/char-fold.el
+++ b/lisp/char-fold.el
@@ -28,7 +28,6 @@
28 (defun char-fold-make-table () 28 (defun char-fold-make-table ()
29 (let* ((equiv (make-char-table 'char-fold-table)) 29 (let* ((equiv (make-char-table 'char-fold-table))
30 (equiv-multi (make-char-table 'char-fold-table)) 30 (equiv-multi (make-char-table 'char-fold-table))
31 (search-spaces-regexp nil) ; workaround for bug#35802
32 (table (unicode-property-table-internal 'decomposition))) 31 (table (unicode-property-table-internal 'decomposition)))
33 (set-char-table-extra-slot equiv 0 equiv-multi) 32 (set-char-table-extra-slot equiv 0 equiv-multi)
34 33
diff --git a/lisp/info.el b/lisp/info.el
index f65c6c36272..8e8c3371f42 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -349,7 +349,9 @@ This only has an effect if `Info-hide-note-references' is non-nil."
349This applies to Info search for regular expressions. 349This applies to Info search for regular expressions.
350You might want to use something like \"[ \\t\\r\\n]+\" instead. 350You might want to use something like \"[ \\t\\r\\n]+\" instead.
351In the Customization buffer, that is `[' followed by a space, 351In the Customization buffer, that is `[' followed by a space,
352a tab, a carriage return (control-M), a newline, and `]+'." 352a tab, a carriage return (control-M), a newline, and `]+'. Don't
353add any capturing groups into this value; that can change the
354numbering of existing capture groups in unexpected ways."
353 :type 'regexp 355 :type 'regexp
354 :group 'info) 356 :group 'info)
355 357
diff --git a/lisp/isearch.el b/lisp/isearch.el
index bb29c2914be..f150a3bba4b 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -129,8 +129,10 @@ regexp incremental search. If the value is nil, or
129then each space you type matches literally, against one space. 129then each space you type matches literally, against one space.
130 130
131You might want to use something like \"[ \\t\\r\\n]+\" instead. 131You might want to use something like \"[ \\t\\r\\n]+\" instead.
132In the Customization buffer, that is `[' followed by a space, 132In the Customization buffer, that is `[' followed by a space, a
133a tab, a carriage return (control-M), a newline, and `]+'." 133tab, a carriage return (control-M), a newline, and `]+'. Don't
134add any capturing groups into this value; that can change the
135numbering of existing capture groups in unexpected ways."
134 :type '(choice (const :tag "Match Spaces Literally" nil) 136 :type '(choice (const :tag "Match Spaces Literally" nil)
135 regexp) 137 regexp)
136 :version "24.3") 138 :version "24.3")
@@ -3263,25 +3265,31 @@ Can be changed via `isearch-search-fun-function' for special needs."
3263(defun isearch-search-fun-default () 3265(defun isearch-search-fun-default ()
3264 "Return default functions to use for the search." 3266 "Return default functions to use for the search."
3265 (lambda (string &optional bound noerror count) 3267 (lambda (string &optional bound noerror count)
3266 ;; Use lax versions to not fail at the end of the word while 3268 (let (;; Evaluate this before binding `search-spaces-regexp' which
3267 ;; the user adds and removes characters in the search string 3269 ;; can break all sorts of regexp searches. In particular,
3268 ;; (or when using nonincremental word isearch) 3270 ;; calling `isearch-regexp-function' can trigger autoloading
3269 (let ((search-spaces-regexp (when (cond 3271 ;; (Bug#35802).
3270 (isearch-regexp isearch-regexp-lax-whitespace) 3272 (regexp
3271 (t isearch-lax-whitespace)) 3273 (cond (isearch-regexp-function
3274 (let ((lax (and (not bound)
3275 (isearch--lax-regexp-function-p))))
3276 (when lax
3277 (setq isearch-adjusted t))
3278 (if (functionp isearch-regexp-function)
3279 (funcall isearch-regexp-function string lax)
3280 (word-search-regexp string lax))))
3281 (isearch-regexp string)
3282 (t (regexp-quote string))))
3283 ;; Use lax versions to not fail at the end of the word while
3284 ;; the user adds and removes characters in the search string
3285 ;; (or when using nonincremental word isearch)
3286 (search-spaces-regexp (when (if isearch-regexp
3287 isearch-regexp-lax-whitespace
3288 isearch-lax-whitespace)
3272 search-whitespace-regexp))) 3289 search-whitespace-regexp)))
3273 (funcall 3290 (funcall
3274 (if isearch-forward #'re-search-forward #'re-search-backward) 3291 (if isearch-forward #'re-search-forward #'re-search-backward)
3275 (cond (isearch-regexp-function 3292 regexp bound noerror count))))
3276 (let ((lax (and (not bound) (isearch--lax-regexp-function-p))))
3277 (when lax
3278 (setq isearch-adjusted t))
3279 (if (functionp isearch-regexp-function)
3280 (funcall isearch-regexp-function string lax)
3281 (word-search-regexp string lax))))
3282 (isearch-regexp string)
3283 (t (regexp-quote string)))
3284 bound noerror count))))
3285 3293
3286(defun isearch-search-string (string bound noerror) 3294(defun isearch-search-string (string bound noerror)
3287 "Search for the first occurrence of STRING or its translation. 3295 "Search for the first occurrence of STRING or its translation.
diff --git a/src/search.c b/src/search.c
index 8a0f707b723..fa574959fb4 100644
--- a/src/search.c
+++ b/src/search.c
@@ -3390,7 +3390,9 @@ syms_of_search (void)
3390Some commands use this for user-specified regexps. 3390Some commands use this for user-specified regexps.
3391Spaces that occur inside character classes or repetition operators 3391Spaces that occur inside character classes or repetition operators
3392or other such regexp constructs are not replaced with this. 3392or other such regexp constructs are not replaced with this.
3393A value of nil (which is the normal value) means treat spaces literally. */); 3393A value of nil (which is the normal value) means treat spaces
3394literally. Note that a value with capturing groups can change the
3395numbering of existing capture groups in unexpected ways. */);
3394 Vsearch_spaces_regexp = Qnil; 3396 Vsearch_spaces_regexp = Qnil;
3395 3397
3396 DEFSYM (Qinhibit_changing_match_data, "inhibit-changing-match-data"); 3398 DEFSYM (Qinhibit_changing_match_data, "inhibit-changing-match-data");
diff --git a/test/lisp/char-fold-tests.el b/test/lisp/char-fold-tests.el
index 8a7414084b0..3fde312a133 100644
--- a/test/lisp/char-fold-tests.el
+++ b/test/lisp/char-fold-tests.el
@@ -124,13 +124,5 @@
124 ;; Ensure it took less than a second. 124 ;; Ensure it took less than a second.
125 (should (< (- (time-to-seconds) time) 1)))))) 125 (should (< (- (time-to-seconds) time) 1))))))
126 126
127(ert-deftest char-fold--test-bug-35802 ()
128 (let* ((char-code-property-alist ; initial value
129 (cons '(decomposition . "uni-decomposition.el")
130 char-code-property-alist))
131 (search-spaces-regexp "\\(\\s-\\|\n\\)+")
132 (char-fold-table (char-fold-make-table)))
133 (char-fold--test-match-exactly "ä" "ä")))
134
135(provide 'char-fold-tests) 127(provide 'char-fold-tests)
136;;; char-fold-tests.el ends here 128;;; char-fold-tests.el ends here