]> code.delx.au - gnu-emacs/commitdiff
* lisp/isearch.el (isearch-search-fun-default): Nicer error
authorArtur Malabarba <bruce.connor.am@gmail.com>
Sun, 29 Nov 2015 22:04:33 +0000 (22:04 +0000)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Sun, 29 Nov 2015 22:09:39 +0000 (22:09 +0000)
message when the search fails.

lisp/isearch.el

index eb5e5baf0b9a7c8540a8693b4256ac0465155c3b..6cbe612d72e33a09f816ba12628493042a92d27f 100644 (file)
@@ -2643,16 +2643,23 @@ Can be changed via `isearch-search-fun-function' for special needs."
                                        (isearch-regexp isearch-regexp-lax-whitespace)
                                        (t isearch-lax-whitespace))
                                   search-whitespace-regexp)))
-      (funcall
-       (if isearch-forward #'re-search-forward #'re-search-backward)
-       (cond (isearch-regexp-function
-              (let ((lax (isearch--lax-regexp-function-p)))
-                (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))))
+      (condition-case er
+          (funcall
+           (if isearch-forward #'re-search-forward #'re-search-backward)
+           (cond (isearch-regexp-function
+                  (let ((lax (isearch--lax-regexp-function-p)))
+                    (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)
+        (search-failed
+         (signal (car er)
+                 (let ((prefix (get isearch-regexp-function 'isearch-message-prefix)))
+                   (if (and isearch-regexp-function (stringp prefix))
+                       (list (format "%s   [using %ssearch]" string prefix))
+                     (cdr er)))))))))
 
 (defun isearch-search-string (string bound noerror)
   "Search for the first occurrence of STRING or its translation.