GNU bug report logs - #69312
30.0.50; [WISHLIST] dicitionary buffer should retain search information

Previous Next

Package: emacs;

Reported by: No Wayman <iarchivedmywholelife <at> gmail.com>

Date: Thu, 22 Feb 2024 18:40:02 UTC

Severity: wishlist

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 69312 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: No Wayman <iarchivedmywholelife <at> gmail.com>
Cc: 69312 <at> debbugs.gnu.org
Subject: Re: bug#69312: 30.0.50; [WISHLIST] dicitionary buffer should retain
 search information
Date: Sun, 25 Feb 2024 09:19:03 +0200
[Message part 1 (text/plain, inline)]
>> @@ -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 "") " \""
>
> This won't work. The buffer is in read-only mode, but even if that is
> inhibited, the string is overwritten by the call to the display function at
> the end:
>
>> (funcall function reply)

This means that we need more reformatting of error messages:

[dictionary-messages.patch (text/x-diff, inline)]
diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el
index 1981b757017..e8ac9b679a0 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,13 +799,13 @@ dictionary-do-search
     (if (dictionary-check-reply reply 552)
 	(progn
 	  (unless nomatching
-	    (insert "Word not found")
+	    (insert (format-message "Word `%s' not found\n" word))
 	    (dictionary-do-matching
              word
 	     dictionary
 	     "."
 	     (lambda (reply)
-               (insert ", maybe you are looking for one of these words\n\n")
+               (insert "Maybe you are looking for one of these words\n")
                (dictionary-display-only-match-result reply)))
 	    (dictionary-post-buffer)))
       (if (dictionary-check-reply reply 550)
@@ -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 "") " \""
@@ -1141,10 +1141,13 @@ dictionary-do-matching
     (if (dictionary-check-reply reply 551)
 	(error "Strategy \"%s\" is invalid" strategy))
     (if (dictionary-check-reply reply 552)
-	(error (concat
-		"No match for \"%s\" with strategy \"%s\" in "
-		"dictionary \"%s\".")
-	       word strategy dictionary))
+	(let ((errmsg (format-message
+                       (concat
+		        "No match for `%s' with strategy `%s' in "
+		        "dictionary `%s'.")
+	               word strategy dictionary)))
+          (insert errmsg "\n")
+          (user-error errmsg)))
     (unless (dictionary-check-reply reply 152)
       (error "Unknown server answer: %s" (dictionary-reply reply)))
     (funcall function reply)))
@@ -1271,7 +1274,7 @@ dictionary-lookup-definition
   (interactive)
   (let ((word (current-word)))
     (unless word
-      (error "No word at point"))
+      (user-error "No word at point"))
     (dictionary-new-search (cons word dictionary-default-dictionary))))
 
 (defun dictionary-previous ()
@@ -1311,7 +1314,8 @@ dictionary-mouse-popup-matching-words
 (defun dictionary-popup-matching-words (&optional word)
   "Display entries matching WORD or the current word if not given."
   (interactive)
-  (dictionary-do-matching (or word (current-word) (error "Nothing to search for"))
+  (dictionary-do-matching (or word (current-word)
+                              (user-error "Nothing to search for"))
 			  dictionary-default-dictionary
 			  dictionary-default-popup-strategy
 			  'dictionary-process-popup-replies))

This bug report was last modified 1 year and 80 days ago.

Previous Next


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