emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Integration of dictionary package


From: Matthias Meulien
Subject: Re: Integration of dictionary package
Date: Sun, 08 Nov 2020 16:16:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Torsten Hilbrich <emacs.nolkaf@hilbrich.tk> writes:

by suggestion of Jean Louis I have started integrating the dictionary package (found on https://github.com/myrkr/dictionary-el/).

Thanks for working on this.

Here are two minor improvments:
- Remove text property from on empty lines
- Add history to read-string

>From 7453384d19e5f662f3623ff998656797ed325f3d Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee@gmail.com>
Date: Sun, 8 Nov 2020 16:06:02 +0100
Subject: [PATCH 1/2] Remove text property from empty line

---
 lisp/net/dictionary.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el
index 8d7d97afe0..6fa1ea408e 100644
--- a/lisp/net/dictionary.el
+++ b/lisp/net/dictionary.el
@@ -762,9 +762,9 @@ dictionary-display-word-entry
            dictionary-description-open-delimiter
            (dictionary-decode-charset description dictionary)
            dictionary-description-close-delimiter
-           " [" (dictionary-decode-charset dictionary dictionary) "]:"
-           "\n\n")
-    (put-text-property start (point) 'face 'dictionary-word-entry-face)))
+           " [" (dictionary-decode-charset dictionary dictionary) "]:")
+    (put-text-property start (point) 'face 'dictionary-word-entry-face)
+    (insert "\n\n")))
 
 (defun dictionary-display-word-definition (reply word dictionary)
   "Insert the definition for the current word"
-- 
2.20.1

>From f4375c800669b1422d2a7aabf729ab04d8a362cf Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee@gmail.com>
Date: Sun, 8 Nov 2020 16:08:07 +0100
Subject: [PATCH 2/2] Add history of search words to read-string

---
 lisp/net/dictionary.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el
index 6fa1ea408e..849b2f35d0 100644
--- a/lisp/net/dictionary.el
+++ b/lisp/net/dictionary.el
@@ -333,6 +333,10 @@ dictionary-color-support
     (error nil))
   "Determines if the Emacs has support to display color")
 
+(defvar dictionary-word-history
+  '()
+  "History list of searched word")
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Basic function providing startup actions
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1092,7 +1096,7 @@ dictionary-search
            (read-string (if default
                             (format "Search word (%s): " default)
                           "Search word: ")
-                        nil nil default))
+                        nil 'dictionary-word-history default))
         (if current-prefix-arg
             (read-string (if dictionary-default-dictionary
                              (format "Dictionary (%s): " 
dictionary-default-dictionary)
@@ -1102,7 +1106,7 @@ dictionary-search
 
   ;; if called by pressing the button
   (unless word
-    (setq word (read-string "Search word: ")))
+    (setq word (read-string "Search word: " nil 'dictionary-word-history)))
   ;; just in case non-interactivly called
   (unless dictionary
     (setq dictionary dictionary-default-dictionary))
@@ -1132,7 +1136,8 @@ dictionary-match-words
   (interactive)
   ;; can't use interactive because of mouse events
   (or pattern
-      (setq pattern (read-string "Search pattern: ")))
+      (setq pattern (read-string "Search pattern: "
+                                 nil 'dictionary-word-history)))
   (dictionary-new-matching pattern))
 
 ;;;###autoload
-- 
2.20.1


--
Matthias

reply via email to

[Prev in Thread] Current Thread [Next in Thread]