From 4f643ac01ff133e4ad088606c7faf03d2c6287b6 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Fri, 21 Jun 2019 07:09:44 -0400 Subject: [PATCH] Don't bind search-spaces-regexp around possible autoload (Bug#35802) * lisp/isearch.el (isearch-search-fun-default): Move possible autoload trigger outside let-binding of search-spaces-regexp. * lisp/char-fold.el (char-fold-make-table): Remove no longer needed workaround. --- lisp/char-fold.el | 1 - lisp/isearch.el | 38 ++++++++++++++++++++++---------------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/lisp/char-fold.el b/lisp/char-fold.el index 7a79873873..7b0e55bb11 100644 --- a/lisp/char-fold.el +++ b/lisp/char-fold.el @@ -28,7 +28,6 @@ (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) diff --git a/lisp/isearch.el b/lisp/isearch.el index bb29c2914b..bfd2e776ec 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -3263,25 +3263,31 @@ (defun isearch--lax-regexp-function-p () (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. -- 2.11.0