emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 d976561: * lisp/isearch.el (isearch-search-fun-de


From: Artur Malabarba
Subject: [Emacs-diffs] emacs-25 d976561: * lisp/isearch.el (isearch-search-fun-default): Nicer error
Date: Sun, 29 Nov 2015 22:09:46 +0000

branch: emacs-25
commit d976561ba29a0de87b692fb985aebe68f3645cdc
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    * lisp/isearch.el (isearch-search-fun-default): Nicer error
    
    message when the search fails.
---
 lisp/isearch.el |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index eb5e5ba..6cbe612 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]