From b4662208cb449e5a260ff84d288e8b9b2ff21453 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Mon, 27 Feb 2023 18:29:05 -0800 Subject: [PATCH] Improve robustness of eldoc-box-help-at-point * eldoc-box.el: (eldoc-box-help-at-point): Guard against unbound variable error. --- eldoc-box.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/eldoc-box.el b/eldoc-box.el index 0f92d8c..5325c9a 100644 --- a/eldoc-box.el +++ b/eldoc-box.el @@ -206,16 +206,18 @@ If (point) != last point, cleanup frame.") (eldoc-box-quit-frame) (kill-local-variable 'eldoc-display-functions))) +;;;###autoload (defun eldoc-box-help-at-point () "Display documentation of the symbol at point." (interactive) - (let ((eldoc-box-position-function - #'eldoc-box--default-at-point-position-function)) - (eldoc-box--display - (with-current-buffer eldoc--doc-buffer - (buffer-string)))) - (setq eldoc-box--help-at-point-last-point (point)) - (run-with-timer 0.1 nil #'eldoc-box--help-at-point-cleanup)) + (when (boundp 'eldoc--doc-buffer) + (let ((eldoc-box-position-function + #'eldoc-box--default-at-point-position-function)) + (eldoc-box--display + (with-current-buffer eldoc--doc-buffer + (buffer-string)))) + (setq eldoc-box--help-at-point-last-point (point)) + (run-with-timer 0.1 nil #'eldoc-box--help-at-point-cleanup))) ;;;; Backstage ;;;;; Variable