Add convenient minor mode for at-point mode

This commit is contained in:
Yuan Fu 2018-12-20 21:56:48 -05:00
parent bbc1139e95
commit 28eb1d7f8a
No known key found for this signature in database
GPG Key ID: 1CF5ECABEC37A901

View File

@ -135,6 +135,23 @@ It will be passes with two arguments: WIDTH and HEIGHT of the childframe.")
(delete-frame eldoc-box--frame)
(setq eldoc-box--frame nil))))
;;;###autoload
(define-minor-mode eldoc-box-hover-at-point-mode
"A convenient minor mode to display doc at point.
You can use C-g to hide the doc."
:lighter ""
(if eldoc-box-hover-at-point-mode
(progn (setq-local
eldoc-box-position-function
#'eldoc-box--default-at-point-position-function)
(setq-local eldoc-box-clear-with-C-g t)
(add-hook 'pre-command-hook #'eldoc-box-quit-frame t t)
(eldoc-box-hover-mode))
(eldoc-box-hover-mode -1)
(remove-hook 'pre-command-hook #'eldoc-box-quit-frame t)
(kill-local-variable 'eldoc-box-position-function)
(kill-local-variable 'eldoc-box-clear-with-C-g)))
;;;; Backstage
;;;;; Variable
(defvar eldoc-box--buffer " *eldoc-box*"