GNU bug report logs - #6106
24.0.50; info.el adds 'search-failed to debug-ignored-errors

Previous Next

Package: emacs;

Reported by: Helmut Eller <eller.helmut <at> gmail.com>

Date: Wed, 5 May 2010 09:57:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 24.0.50

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: npostavs <at> users.sourceforge.net
To: Juri Linkov <juri <at> jurta.org>
Cc: Mark Oteiza <mvoteiza <at> udel.edu>, 6106 <at> debbugs.gnu.org, Helmut Eller <eller.helmut <at> gmail.com>
Subject: bug#6106: 24.0.50; info.el adds 'search-failed to debug-ignored-errors
Date: Sat, 01 Apr 2017 09:43:59 -0400
[Message part 1 (text/plain, inline)]
npostavs <at> users.sourceforge.net writes:

> (Info-select-node, Info-search): Replace (signal 'search-failed ...)
> with (user-error "Search failed: "...).

Turns out this breaks isearch over multiple nodes, as noted by Mark
Oteiza in [1].  I believe this is fixed by the patch below.

[1]: http://lists.gnu.org/archive/html/emacs-devel/2017-03/msg00869.html

[v1-0001-Throw-a-search-failed-derived-error-in-Info-searc.patch (text/x-diff, inline)]
From 2cb893febdf06282c1183b3e4f4de8728bbe44b9 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Sat, 1 Apr 2017 09:34:04 -0400
Subject: [PATCH v1] 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.
* lisp/info.el (Info-search): Use it instead of `user-error' so that
isearch will handle failed searches correctly.
---
 lisp/info.el | 12 ++++++------
 src/search.c |  9 +++++++++
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/lisp/info.el b/lisp/info.el
index a6bab290a7..81e5d29f82 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1998,20 +1998,20 @@ Info-search
                   Info-isearch-initial-node
                   bound
                   (and found (> found opoint-min) (< found opoint-max)))
-	(user-error "Search failed: `%s' (end of node)" regexp))
+	(signal 'user-search-failed (list regexp "(end of node)")))
 
       ;; If no subfiles, give error now.
       (unless (or found Info-current-subfile)
         (if isearch-mode
-            (user-error "Search failed: `%s' (end of manual)" regexp)
+            (signal 'user-search-failed (list regexp "end of manual"))
           (let ((search-spaces-regexp Info-search-whitespace-regexp))
             (unless (if backward
                         (re-search-backward regexp nil t)
                       (re-search-forward regexp nil t))
-              (user-error "Search failed: `%s'" regexp)))))
+              (signal 'user-seach-failed (list regexp))))))
 
       (if (and bound (not found))
-          (user-error "Search failed: `%s'" regexp))
+          (signal 'user-search-failed (list regexp)))
 
       (unless (or found bound)
 	(unwind-protect
@@ -2055,8 +2055,8 @@ Info-search
 		    (setq list nil)))
 	      (if found
 		  (message "")
-                (user-error "Search failed: `%s'%s"
-                            regexp (if isearch-mode " (end of manual)" ""))))
+                (signal 'user-search-failed
+                        `(,regexp ,@(if isearch-mode '("end of manual"))))))
 	  (if (not found)
 	      (progn (Info-read-subfile osubfile)
 		     (goto-char opoint)
diff --git a/src/search.c b/src/search.c
index 33cb02aa7a..48caea2f51 100644
--- a/src/search.c
+++ b/src/search.c
@@ -3389,6 +3389,10 @@ syms_of_search (void)
   /* Error condition used for failing searches.  */
   DEFSYM (Qsearch_failed, "search-failed");
 
+  /* Error condition used for failing searches started by user, i.e.,
+     where failure should not invoke the debugger.  */
+  DEFSYM (Quser_search_failed, "search-failed");
+
   /* Error condition signaled when regexp compile_pattern fails.  */
   DEFSYM (Qinvalid_regexp, "invalid-regexp");
 
@@ -3397,6 +3401,11 @@ syms_of_search (void)
   Fput (Qsearch_failed, Qerror_message,
 	build_pure_c_string ("Search failed"));
 
+  Fput (Quser_search_failed, Qerror_conditions,
+	listn (CONSTYPE_PURE, 2, Qsearch_failed, Quser_error));
+  Fput (Quser_search_failed, Qerror_message,
+	build_pure_c_string ("Search failed"));
+
   Fput (Qinvalid_regexp, Qerror_conditions,
 	listn (CONSTYPE_PURE, 2, Qinvalid_regexp, Qerror));
   Fput (Qinvalid_regexp, Qerror_message,
-- 
2.11.1


This bug report was last modified 8 years and 103 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.