This applies to Info search for regular expressions.
You might want to use something like \"[ \\t\\r\\n]+\" instead.
In the Customization buffer, that is `[' followed by a space,
-a tab, a carriage return (control-M), a newline, and `]+'."
+a tab, a carriage return (control-M), a newline, and `]+'. Don't
+add any capturing groups into this value; that can change the
+numbering of existing capture groups in unexpected ways."
:type 'regexp
:group 'info)
then each space you type matches literally, against one space.
You might want to use something like \"[ \\t\\r\\n]+\" instead.
-In the Customization buffer, that is `[' followed by a space,
-a tab, a carriage return (control-M), a newline, and `]+'."
+In the Customization buffer, that is `[' followed by a space, a
+tab, a carriage return (control-M), a newline, and `]+'. Don't
+add any capturing groups into this value; that can change the
+numbering of existing capture groups in unexpected ways."
:type '(choice (const :tag "Match Spaces Literally" nil)
regexp)
:version "24.3")
(defun isearch-search-fun-default ()
"Return default functions to use for the search."
(lambda (string &optional bound noerror count)
- ;; Use lax versions to not fail at the end of the word while
- ;; the user adds and removes characters in the search string
- ;; (or when using nonincremental word isearch)
- (let ((search-spaces-regexp (when (cond
- (isearch-regexp isearch-regexp-lax-whitespace)
- (t isearch-lax-whitespace))
+ (let (;; Evaluate this before binding `search-spaces-regexp' which
+ ;; can break all sorts of regexp searches. In particular,
+ ;; calling `isearch-regexp-function' can trigger autoloading
+ ;; (Bug#35802).
+ (regexp
+ (cond (isearch-regexp-function
+ (let ((lax (and (not bound)
+ (isearch--lax-regexp-function-p))))
+ (when lax
+ (setq isearch-adjusted t))
+ (if (functionp isearch-regexp-function)
+ (funcall isearch-regexp-function string lax)
+ (word-search-regexp string lax))))
+ (isearch-regexp string)
+ (t (regexp-quote string))))
+ ;; Use lax versions to not fail at the end of the word while
+ ;; the user adds and removes characters in the search string
+ ;; (or when using nonincremental word isearch)
+ (search-spaces-regexp (when (if isearch-regexp
+ isearch-regexp-lax-whitespace
+ isearch-lax-whitespace)
search-whitespace-regexp)))
(funcall
(if isearch-forward #'re-search-forward #'re-search-backward)
- (cond (isearch-regexp-function
- (let ((lax (and (not bound) (isearch--lax-regexp-function-p))))
- (when lax
- (setq isearch-adjusted t))
- (if (functionp isearch-regexp-function)
- (funcall isearch-regexp-function string lax)
- (word-search-regexp string lax))))
- (isearch-regexp string)
- (t (regexp-quote string)))
- bound noerror count))))
+ regexp bound noerror count))))
(defun isearch-search-string (string bound noerror)
"Search for the first occurrence of STRING or its translation.
Some commands use this for user-specified regexps.
Spaces that occur inside character classes or repetition operators
or other such regexp constructs are not replaced with this.
-A value of nil (which is the normal value) means treat spaces literally. */);
+A value of nil (which is the normal value) means treat spaces
+literally. Note that a value with capturing groups can change the
+numbering of existing capture groups in unexpected ways. */);
Vsearch_spaces_regexp = Qnil;
DEFSYM (Qinhibit_changing_match_data, "inhibit-changing-match-data");
;; Ensure it took less than a second.
(should (< (- (time-to-seconds) time) 1))))))
-(ert-deftest char-fold--test-bug-35802 ()
- (let* ((char-code-property-alist ; initial value
- (cons '(decomposition . "uni-decomposition.el")
- char-code-property-alist))
- (search-spaces-regexp "\\(\\s-\\|\n\\)+")
- (char-fold-table (char-fold-make-table)))
- (char-fold--test-match-exactly "ä" "ä")))
-
(provide 'char-fold-tests)
;;; char-fold-tests.el ends here