Subject: bug#12078: 24.1; Improve the I-search prompt

From: Juri Linkov <[email-masked]>
Date: Sun, 29 Jul 2012 21:04:51 +0300

>>   Failing I-search: foobar
>>   Overwrapped I-search: foobar
>>   Failing overwrapped I-search: foobar
>>   Failing I-search: foobar [initial node]
>>
>> would be
>>
>>   I-search: foobar  [failing]
>>   I-search: foobar  [overwrapped]
>>   I-search: foobar  [failing, overwrapped]
>>   I-search: foobar  [failing, initial node]
>
> I think we should distinguish between momentary messages and search states.
> For instance, "failing" is a momentary message, but "overwrapped"
> is a search state.  It would be very annoying to display persistent
> search states like "overwrapped" at the end of the search prompt.

So what could be moved to the end of the search string are two messages
"failing" and "pending".  With the following patch a failed search will
display the message suffix "[failed]".  A failed search in Info will
display the message suffix either "[failed at the end of node]" or
"[failed at the end of manual]", and pending will display "[pending]".

I don't propose to install this change immediately.
Please try this out for a while.

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2012-07-18 09:27:23 +0000
+++ lisp/isearch.el	2012-07-29 18:01:27 +0000
@@ -2371,8 +2412,8 @@ (defun isearch-message-prefix (&optional
 	 (error nil)))
   ;; If currently failing, display no ellipsis.
   (or isearch-success (setq ellipsis nil))
-  (let ((m (concat (if isearch-success "" "failing ")
-		   (if isearch-adjusted "pending " "")
+  (let ((m (concat ;; (if isearch-success "" "failing ")
+		   ;; (if isearch-adjusted "pending " "")
 		   (if (and isearch-wrapped
 			    (not isearch-wrap-function)
 			    (if isearch-forward
@@ -2402,11 +2448,14 @@ (defun isearch-message-prefix (&optional
 		'face 'minibuffer-prompt)))
 
 (defun isearch-message-suffix (&optional c-q-hack _ellipsis)
-  (concat (if c-q-hack "^Q" "")
-	  (if isearch-error
-	      (concat " [" isearch-error "]")
-	    "")
-	  (or isearch-message-suffix-add "")))
+  (let ((m (mapconcat 'identity
+		      (delq nil (list (if (not isearch-success) "failed")
+				      (if isearch-adjusted "pending")
+				      isearch-error))
+		      " ")))
+    (concat (if c-q-hack "^Q" "")
+	    (if (> (length m) 0) (concat " [" m "]") "")
+	    (or isearch-message-suffix-add ""))))
 
 
 ;; Searching

=== modified file 'lisp/info.el'
--- lisp/info.el	2012-07-10 11:51:54 +0000
+++ lisp/info.el	2012-07-29 18:01:28 +0000
@@ -1863,13 +1867,13 @@ (defun Info-search (regexp &optional bou
 		 (not bound)
 		 (or give-up (and found (not (and (> found opoint-min)
 						  (< found opoint-max))))))
-	(signal 'search-failed (list regexp "initial node")))
+	(signal 'search-failed (list regexp "at the end of node")))
 
       ;; If no subfiles, give error now.
       (if give-up
 	  (if (null Info-current-subfile)
 	      (if isearch-mode
-		  (signal 'search-failed (list regexp "end of manual"))
+		  (signal 'search-failed (list regexp "at the end of manual"))
 		(let ((search-spaces-regexp
 		       (if (or (not isearch-mode) isearch-regexp)
 			   Info-search-whitespace-regexp)))
@@ -1946,7 +1951,7 @@ (defun Info-search (regexp &optional bou
 	      (if found
 		  (message "")
 		(signal 'search-failed (if isearch-mode
-					   (list regexp "end of manual")
+					   (list regexp "at the end of manual")
 					 (list regexp)))))
 	  (if (not found)
 	      (progn (Info-read-subfile osubfile)