# HG changeset patch # User Oleksandr Gavenko # Date 1605358670 -7200 # Node ID 2fd7afb6a12e9f980b973c690b9c8188a9937dc6 # Parent a4657a3d08fef5599f36a08c11295200a0dd9bce Added separate history support for gadict Emacs mode. diff -r a4657a3d08fe -r 2fd7afb6a12e misc/gadict.el --- a/misc/gadict.el Mon Nov 09 19:49:48 2020 +0200 +++ b/misc/gadict.el Sat Nov 14 14:57:50 2020 +0200 @@ -310,10 +310,15 @@ (throw 'exit nil)) (setq prev curr)) ))) +(defvar gadict--headword-history nil + "History for gadict's headwords.") +(defvar gadict--pos-history nil + "History for gadict's POS.") + (defun gadict-search (headword) "Move to HEADWORD definition or place on posiiton for new corresponding definition. Check for headwords ordering during search." - (interactive (list (read-string "Headword: "))) + (interactive (list (read-string "Headword: " nil 'gadict--headword-history))) (gadict-search-floor headword) (recenter)) @@ -321,9 +326,9 @@ "Insert new article template with respect of headword order." (interactive) (let (headword pos) - (setq headword (read-string "Headword: ")) + (setq headword (read-string "Headword: " nil 'gadict--headword-history)) (unless (gadict-search-floor headword) - (setq pos (completing-read "POS: " gadict--pos nil t)) + (setq pos (completing-read "POS: " gadict--pos nil t nil 'gadict--pos-history)) (gadict-insert-article headword pos) (recenter)))) @@ -338,7 +343,7 @@ (defun gadict-insert-translation (pos) "Insert translation template using value of `gadict-tr'." - (interactive (list (completing-read "POS: " gadict--pos nil t))) + (interactive (list (completing-read "POS: " gadict--pos nil t nil 'gadict--pos-history))) (let ( (headword-end (gadict--find-headword-end)) ) (if (< (point) headword-end) (goto-char headword-end)