Add support for company-box

* eldoc-box.el (eldoc-box--at-point-x-by-company): Change if to a cond
and add a branch for company-box.
This commit is contained in:
Yuan Fu 2023-08-02 17:51:41 -07:00
parent f6ae0e7a7b
commit b5aa481432
No known key found for this signature in database
GPG Key ID: 56E19BC57664A442

View File

@ -669,15 +669,23 @@ instead."
;; please compiler
(defvar company-pseudo-tooltip-overlay)
(declare-function company-box--get-frame "company-box")
(defun eldoc-box--at-point-x-by-company ()
"Return the x position that accommodates company's popup."
(if (and (featurep 'company) company-pseudo-tooltip-overlay)
(+ (* (frame-char-width)
(+ (overlay-get company-pseudo-tooltip-overlay 'company-width)
(overlay-get company-pseudo-tooltip-overlay 'company-column)))
(or (line-number-display-width t) 0))
nil))
(cond
((and (boundp 'company-pseudo-tooltip-overlay)
company-pseudo-tooltip-overlay)
(+ (* (frame-char-width)
(+ (overlay-get company-pseudo-tooltip-overlay
'company-width)
(overlay-get company-pseudo-tooltip-overlay
'company-column)))
(or (line-number-display-width t) 0)))
((and (boundp 'company-box--x) (numberp company-box--x))
(+ company-box--x
(frame-pixel-width (company-box--get-frame))))
(t nil)))
;;;; Markdown compatibility