From 28eb1d7f8ac1532c8a81d7b339e3dc905014c98d Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Thu, 20 Dec 2018 21:56:48 -0500 Subject: [PATCH] Add convenient minor mode for at-point mode --- eldoc-box.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/eldoc-box.el b/eldoc-box.el index 48c968b..38ac6cf 100644 --- a/eldoc-box.el +++ b/eldoc-box.el @@ -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*"