Subject: bug#70058: 29.3; `Info-search-case-sensitively' errors with "Wrong type argument: stringp, nil" on failed search

From: Eli Zaretskii <[email-masked]>
Date: Thu, 28 Mar 2024 22:19:41 +0200

> Date: Thu, 28 Mar 2024 17:40:35 +0100
> From:  Alcor via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> 
> 1. Run Emacs with 'emacs -Q'
> 2. Press C-h i to open the Emacs Info pages
> 3. Press S (capital s, aka `Info-search-case-sensitively')
> 4. In the minibuffer prompt, type "emacs" or "remember"
> 
> Observed result:
> 
>   Wrong type argument: stringp, nil
> 
> is echoed in the echo area.
> 
> Expected result:
> 
>   Search failed: "abcdr"

Does the patch below give good results?

diff --git a/lisp/info.el b/lisp/info.el
index 1c6df9a..5817737 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -2056,7 +2056,7 @@ Info-search
                       (re-search-forward regexp nil t))
               (signal 'user-search-failed (list regexp))))))
 
-      (if (and bound (not found))
+      (if (and (or bound (not Info-current-subfile)) (not found))
           (signal 'user-search-failed (list regexp)))
 
       (unless (or found bound)