misc/gadict.el
changeset 1294 3940e242e941
parent 1267 2fd7afb6a12e
equal deleted inserted replaced
1293:d6aa9445a749 1294:3940e242e941
   318 (defun gadict-search (headword)
   318 (defun gadict-search (headword)
   319   "Move to HEADWORD definition or place on posiiton for new corresponding
   319   "Move to HEADWORD definition or place on posiiton for new corresponding
   320 definition. Check for headwords ordering during search."
   320 definition. Check for headwords ordering during search."
   321   (interactive (list (read-string "Headword: " nil 'gadict--headword-history)))
   321   (interactive (list (read-string "Headword: " nil 'gadict--headword-history)))
   322   (gadict-search-floor headword)
   322   (gadict-search-floor headword)
   323   (recenter))
   323   ;; Position view for the best article visibility in the buffer.
       
   324   (recenter 1))
   324 
   325 
   325 (defun gadict-insert-article-in-order ()
   326 (defun gadict-insert-article-in-order ()
   326   "Insert new article template with respect of headword order."
   327   "Insert new article template with respect of headword order."
   327   (interactive)
   328   (interactive)
   328   (let (headword pos)
   329   (let (headword pos)
   329     (setq headword (read-string "Headword: " nil 'gadict--headword-history))
   330     (setq headword (read-string "Headword: " nil 'gadict--headword-history))
   330     (unless (gadict-search-floor headword)
   331     (unless (gadict-search-floor headword)
   331       (setq pos (completing-read "POS: " gadict--pos nil t nil 'gadict--pos-history))
   332       (setq pos (completing-read "POS: " gadict--pos nil t nil 'gadict--pos-history))
   332       (gadict-insert-article headword pos)
   333       (gadict-insert-article headword pos))
   333       (recenter))))
   334     ;; Position view for the best article visibility in the buffer.
       
   335     (recenter (+ scroll-margin 2))))
   334 
   336 
   335 (defun gadict--find-headword-end ()
   337 (defun gadict--find-headword-end ()
   336   (save-excursion
   338   (save-excursion
   337     (end-of-line)
   339     (end-of-line)
   338     (re-search-backward "^__$")
   340     (re-search-backward "^__$")