aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Postavsky2017-04-01 09:34:04 -0400
committerNoam Postavsky2017-04-03 19:36:14 -0400
commit3887c54544bc2e5f8c2e7c12973887f9b2b88c40 (patch)
tree28023c5157ac0504d3f3cefd65943304e140ab36
parent49197e6e3d30a4da91d5f18041dd125ac327592a (diff)
downloademacs-3887c54544bc2e5f8c2e7c12973887f9b2b88c40.tar.gz
emacs-3887c54544bc2e5f8c2e7c12973887f9b2b88c40.zip
Throw a `search-failed' derived error in Info search
The original fix for Bug#6106 switched from signalling `search-failed' to `user-error'. However, this breaks incremental searching over multiple nodes because the isearch code doesn't expect a `user-error'. * src/search.c (syms_of_search): New error, `user-search-failed', with `user-error' and `search-failed' as parents. * doc/lispref/errors.texi (Standard Errors): Document it. * etc/NEWS: Announce it. * lisp/info.el (Info-search): Use it instead of `user-error' so that isearch will handle failed searches correctly.
-rw-r--r--doc/lispref/errors.texi6
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/info.el12
-rw-r--r--src/search.c10
4 files changed, 26 insertions, 6 deletions
diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi
index 2ec1a108ea9..1f67819c34e 100644
--- a/doc/lispref/errors.texi
+++ b/doc/lispref/errors.texi
@@ -186,6 +186,12 @@ The message is @samp{Undefined color}. @xref{Color Names}.
186@item user-error 186@item user-error
187The message is the empty string. @xref{Signaling Errors}. 187The message is the empty string. @xref{Signaling Errors}.
188 188
189@item user-search-failed
190This is like @samp{search-failed}, but doesn't trigger the debugger,
191like @samp{user-error}. @xref{Signaling Errors}, and @xref{Searching
192and Matching}. This is used for searching in Info files, @xref{Search
193Text,,,info,Info}.
194
189@item void-function 195@item void-function
190The message is @samp{Symbol's function definition is void}. 196The message is @samp{Symbol's function definition is void}.
191@xref{Function Cells}. 197@xref{Function Cells}.
diff --git a/etc/NEWS b/etc/NEWS
index bfd7d2bd32a..fc076569862 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1058,6 +1058,10 @@ its window gets deleted by 'delete-other-windows'.
1058*** New command 'window-swap-states' swaps the states of two live 1058*** New command 'window-swap-states' swaps the states of two live
1059windows. 1059windows.
1060 1060
1061+++
1062*** New error type 'user-search-failed' like 'search-failed' but
1063avoids debugger like 'user-error'.
1064
1061 1065
1062* Changes in Emacs 26.1 on Non-Free Operating Systems 1066* Changes in Emacs 26.1 on Non-Free Operating Systems
1063 1067
diff --git a/lisp/info.el b/lisp/info.el
index a6bab290a72..81e5d29f827 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1998,20 +1998,20 @@ If DIRECTION is `backward', search in the reverse direction."
1998 Info-isearch-initial-node 1998 Info-isearch-initial-node
1999 bound 1999 bound
2000 (and found (> found opoint-min) (< found opoint-max))) 2000 (and found (> found opoint-min) (< found opoint-max)))
2001 (user-error "Search failed: `%s' (end of node)" regexp)) 2001 (signal 'user-search-failed (list regexp "(end of node)")))
2002 2002
2003 ;; If no subfiles, give error now. 2003 ;; If no subfiles, give error now.
2004 (unless (or found Info-current-subfile) 2004 (unless (or found Info-current-subfile)
2005 (if isearch-mode 2005 (if isearch-mode
2006 (user-error "Search failed: `%s' (end of manual)" regexp) 2006 (signal 'user-search-failed (list regexp "end of manual"))
2007 (let ((search-spaces-regexp Info-search-whitespace-regexp)) 2007 (let ((search-spaces-regexp Info-search-whitespace-regexp))
2008 (unless (if backward 2008 (unless (if backward
2009 (re-search-backward regexp nil t) 2009 (re-search-backward regexp nil t)
2010 (re-search-forward regexp nil t)) 2010 (re-search-forward regexp nil t))
2011 (user-error "Search failed: `%s'" regexp))))) 2011 (signal 'user-seach-failed (list regexp))))))
2012 2012
2013 (if (and bound (not found)) 2013 (if (and bound (not found))
2014 (user-error "Search failed: `%s'" regexp)) 2014 (signal 'user-search-failed (list regexp)))
2015 2015
2016 (unless (or found bound) 2016 (unless (or found bound)
2017 (unwind-protect 2017 (unwind-protect
@@ -2055,8 +2055,8 @@ If DIRECTION is `backward', search in the reverse direction."
2055 (setq list nil))) 2055 (setq list nil)))
2056 (if found 2056 (if found
2057 (message "") 2057 (message "")
2058 (user-error "Search failed: `%s'%s" 2058 (signal 'user-search-failed
2059 regexp (if isearch-mode " (end of manual)" "")))) 2059 `(,regexp ,@(if isearch-mode '("end of manual"))))))
2060 (if (not found) 2060 (if (not found)
2061 (progn (Info-read-subfile osubfile) 2061 (progn (Info-read-subfile osubfile)
2062 (goto-char opoint) 2062 (goto-char opoint)
diff --git a/src/search.c b/src/search.c
index 33cb02aa7af..c0deb57213c 100644
--- a/src/search.c
+++ b/src/search.c
@@ -3389,6 +3389,10 @@ syms_of_search (void)
3389 /* Error condition used for failing searches. */ 3389 /* Error condition used for failing searches. */
3390 DEFSYM (Qsearch_failed, "search-failed"); 3390 DEFSYM (Qsearch_failed, "search-failed");
3391 3391
3392 /* Error condition used for failing searches started by user, i.e.,
3393 where failure should not invoke the debugger. */
3394 DEFSYM (Quser_search_failed, "user-search-failed");
3395
3392 /* Error condition signaled when regexp compile_pattern fails. */ 3396 /* Error condition signaled when regexp compile_pattern fails. */
3393 DEFSYM (Qinvalid_regexp, "invalid-regexp"); 3397 DEFSYM (Qinvalid_regexp, "invalid-regexp");
3394 3398
@@ -3397,6 +3401,12 @@ syms_of_search (void)
3397 Fput (Qsearch_failed, Qerror_message, 3401 Fput (Qsearch_failed, Qerror_message,
3398 build_pure_c_string ("Search failed")); 3402 build_pure_c_string ("Search failed"));
3399 3403
3404 Fput (Quser_search_failed, Qerror_conditions,
3405 listn (CONSTYPE_PURE, 4,
3406 Quser_search_failed, Quser_error, Qsearch_failed, Qerror));
3407 Fput (Quser_search_failed, Qerror_message,
3408 build_pure_c_string ("Search failed"));
3409
3400 Fput (Qinvalid_regexp, Qerror_conditions, 3410 Fput (Qinvalid_regexp, Qerror_conditions,
3401 listn (CONSTYPE_PURE, 2, Qinvalid_regexp, Qerror)); 3411 listn (CONSTYPE_PURE, 2, Qinvalid_regexp, Qerror));
3402 Fput (Qinvalid_regexp, Qerror_message, 3412 Fput (Qinvalid_regexp, Qerror_message,