From f4375c800669b1422d2a7aabf729ab04d8a362cf Mon Sep 17 00:00:00 2001 From: Matthias Meulien 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