Improve robustness of eldoc-box-help-at-point

* eldoc-box.el:
(eldoc-box-help-at-point): Guard against unbound variable error.
This commit is contained in:
Yuan Fu 2023-02-27 18:29:05 -08:00
parent eea7dd8371
commit b4662208cb
No known key found for this signature in database
GPG Key ID: 56E19BC57664A442

View File

@ -206,16 +206,18 @@ If (point) != last point, cleanup frame.")
(eldoc-box-quit-frame) (eldoc-box-quit-frame)
(kill-local-variable 'eldoc-display-functions))) (kill-local-variable 'eldoc-display-functions)))
;;;###autoload
(defun eldoc-box-help-at-point () (defun eldoc-box-help-at-point ()
"Display documentation of the symbol at point." "Display documentation of the symbol at point."
(interactive) (interactive)
(let ((eldoc-box-position-function (when (boundp 'eldoc--doc-buffer)
#'eldoc-box--default-at-point-position-function)) (let ((eldoc-box-position-function
(eldoc-box--display #'eldoc-box--default-at-point-position-function))
(with-current-buffer eldoc--doc-buffer (eldoc-box--display
(buffer-string)))) (with-current-buffer eldoc--doc-buffer
(setq eldoc-box--help-at-point-last-point (point)) (buffer-string))))
(run-with-timer 0.1 nil #'eldoc-box--help-at-point-cleanup)) (setq eldoc-box--help-at-point-last-point (point))
(run-with-timer 0.1 nil #'eldoc-box--help-at-point-cleanup)))
;;;; Backstage ;;;; Backstage
;;;;; Variable ;;;;; Variable