Recenter screen to article on search request.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 17 Apr 2016 20:32:02 +0300
changeset 448 a61c140a4b6f
parent 447 e72fc3940606
child 449 dafbf45a7b51
Recenter screen to article on search request.
contrib/gadict.el
--- a/contrib/gadict.el	Fri Apr 15 21:38:18 2016 +0300
+++ b/contrib/gadict.el	Sun Apr 17 20:32:02 2016 +0300
@@ -143,7 +143,6 @@
 definition. Check for headwords ordering during search.
 
 Return `t' if definition found, `nil' if no such headword."
-  (interactive (list (read-string "Headword: ")))
   (let ( prev curr )
     (catch 'exit
       (goto-char (point-min))
@@ -172,6 +171,13 @@
           (throw 'exit nil))
         (setq prev curr)) )))
 
+(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: ")))
+  (gadict-search-floor headword)
+  (recenter-top-bottom))
+
 (defun gadict-insert-template-in-order (headword)
   "Insert new article template with respect of headword order."
   (interactive (list (read-string "Headword: ")))
@@ -181,7 +187,7 @@
 
 (defun gadict-setup-keymap ()
   "Setup gadict keymap."
-  (define-key (current-local-map) [S-return] 'gadict-search-floor)
+  (define-key (current-local-map) [S-return] 'gadict-search)
   (define-key (current-local-map) [C-return] 'gadict-insert-template-in-order))
 
 ;;;###autoload