# HG changeset patch # User Oleksandr Gavenko # Date 1617375936 -10800 # Node ID 3940e242e941851906407243bf0a5f0e904a78f4 # Parent d6aa9445a749d24bcb21fa3be982a7aa2cd6271f Position view for the best article visibility in the buffer. diff -r d6aa9445a749 -r 3940e242e941 misc/gadict.el --- a/misc/gadict.el Thu Apr 01 23:13:47 2021 +0300 +++ b/misc/gadict.el Fri Apr 02 18:05:36 2021 +0300 @@ -320,7 +320,8 @@ definition. Check for headwords ordering during search." (interactive (list (read-string "Headword: " nil 'gadict--headword-history))) (gadict-search-floor headword) - (recenter)) + ;; Position view for the best article visibility in the buffer. + (recenter 1)) (defun gadict-insert-article-in-order () "Insert new article template with respect of headword order." @@ -329,8 +330,9 @@ (setq headword (read-string "Headword: " nil 'gadict--headword-history)) (unless (gadict-search-floor headword) (setq pos (completing-read "POS: " gadict--pos nil t nil 'gadict--pos-history)) - (gadict-insert-article headword pos) - (recenter)))) + (gadict-insert-article headword pos)) + ;; Position view for the best article visibility in the buffer. + (recenter (+ scroll-margin 2)))) (defun gadict--find-headword-end () (save-excursion