Add history of search words to read-string

This commit is contained in:
Matthias Meulien 2020-11-08 16:08:07 +01:00 committed by Torsten Hilbrich
parent 28fe134971
commit 7ca331a4f9

View file

@ -344,6 +344,10 @@ is utf-8"
(error nil)) (error nil))
"Determines if the Emacs has support to display color") "Determines if the Emacs has support to display color")
(defvar dictionary-word-history
'()
"History list of searched word")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Basic function providing startup actions ;; Basic function providing startup actions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -1118,7 +1122,7 @@ It presents the word at point as default input and allows editing it."
(read-string (if default (read-string (if default
(format "Search word (%s): " default) (format "Search word (%s): " default)
"Search word: ") "Search word: ")
nil nil default)) nil 'dictionary-word-history default))
(if current-prefix-arg (if current-prefix-arg
(read-string (if dictionary-default-dictionary (read-string (if dictionary-default-dictionary
(format "Dictionary (%s): " dictionary-default-dictionary) (format "Dictionary (%s): " dictionary-default-dictionary)
@ -1128,7 +1132,7 @@ It presents the word at point as default input and allows editing it."
;; if called by pressing the button ;; if called by pressing the button
(unless word (unless word
(setq word (read-string "Search word: "))) (setq word (read-string "Search word: " nil 'dictionary-word-history)))
;; just in case non-interactivly called ;; just in case non-interactivly called
(unless dictionary (unless dictionary
(setq dictionary dictionary-default-dictionary)) (setq dictionary dictionary-default-dictionary))
@ -1158,7 +1162,8 @@ It presents the word at point as default input and allows editing it."
(interactive) (interactive)
;; can't use interactive because of mouse events ;; can't use interactive because of mouse events
(or pattern (or pattern
(setq pattern (read-string "Search pattern: "))) (setq pattern (read-string "Search pattern: "
nil 'dictionary-word-history)))
(dictionary-new-matching pattern)) (dictionary-new-matching pattern))
;;;###autoload ;;;###autoload