diff --git a/eldoc-box.el b/eldoc-box.el index f8259fa..973a270 100644 --- a/eldoc-box.el +++ b/eldoc-box.el @@ -145,17 +145,19 @@ It will be passes with two arguments: WIDTH and HEIGHT of the childframe.") "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) - (remove-hook 'pre-command-hook #'eldoc-pre-command-refresh-echo-area t) - (add-hook 'pre-command-hook #'eldoc-box-quit-frame t t)) - (add-hook 'pre-command-hook #'eldoc-pre-command-refresh-echo-area t) - (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))) + (if eldoc-box-hover-mode + (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) + (remove-hook 'pre-command-hook #'eldoc-pre-command-refresh-echo-area t) + (add-hook 'pre-command-hook #'eldoc-box-quit-frame t t)) + (add-hook 'pre-command-hook #'eldoc-pre-command-refresh-echo-area t) + (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)) + (message "Enable eldoc-box-hover-mode first"))) ;;;; Backstage ;;;;; Variable