Subject: Re: bug#69312: 30.0.50; [WISHLIST] dicitionary buffer should retain search information

From: Juri Linkov <[email-masked]>
Date: Sat, 24 Feb 2024 19:39:02 +0200

>> diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el
>> index 1981b757017..ccce0b541df 100644
>> --- a/lisp/net/dictionary.el
>> +++ b/lisp/net/dictionary.el
>> @@ -787,7 +787,7 @@ dictionary-do-search
>>  Optional argument NOMATCHING controls whether to suppress the  display
>>  of matching words."
>>  -  (message "Searching for %s in %s" word dictionary)
>> +  (insert (format "Searching for %s in %s\n" word dictionary))
>>    (dictionary-send-command (concat "define "
>>  				   (dictionary-encode-charset dictionary "")
>>  				   " \""
>
> Thanks, Juri. This takes care of dictionary-do-search, but
> dictionary-do-matching indirectly calls the function responsible for
> displaying the results and does not pass the query along. So a similar
> modification will not work there.

Sorry, I didn't notice there is another place:

diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el
index 1981b757017..e2fc2d823fd 100644
--- a/lisp/net/dictionary.el
+++ b/lisp/net/dictionary.el
@@ -787,7 +787,7 @@ dictionary-do-search
 Optional argument NOMATCHING controls whether to suppress the display
 of matching words."
 
-  (message "Searching for %s in %s" word dictionary)
+  (insert (format-message "Searching for %s in %s\n" word dictionary))
   (dictionary-send-command (concat "define "
 				   (dictionary-encode-charset dictionary "")
 				   " \""
@@ -799,7 +799,7 @@ dictionary-do-search
     (if (dictionary-check-reply reply 552)
 	(progn
 	  (unless nomatching
-	    (insert "Word not found")
+	    (insert (format-message "Word not found: %s\n" word))
 	    (dictionary-do-matching
              word
 	     dictionary
@@ -1128,8 +1128,8 @@ dictionary-new-matching
 
 (defun dictionary-do-matching (word dictionary strategy function)
   "Search for WORD with STRATEGY in DICTIONARY and display them with FUNCTION."
-  (message "Lookup matching words for %s in %s using %s"
-	   word dictionary strategy)
+  (insert (format-message "Lookup matching words for %s in %s using %s\n"
+	                  word dictionary strategy))
   (dictionary-send-command
    (concat "match " (dictionary-encode-charset dictionary "") " "
 	   (dictionary-encode-charset strategy "") " \""