branch: externals/posframe commit 2e89f6b5ebc158f048afecb5f30e9b24dc0477be Author: Mark A. Hershberger <m...@nichework.com> Commit: Mark A. Hershberger <m...@nichework.com>
Make posframe work for `emacs -nw` In text mode, the function `font-at` returns nil. Meanwhile `font-info` expects a string. --- posframe.el | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/posframe.el b/posframe.el index 7ef18a2..6a23f03 100644 --- a/posframe.el +++ b/posframe.el @@ -531,15 +531,13 @@ you can use `posframe-delete-all' to delete all posframes." "Get the font's height at POSITION." (if (eq position (car posframe--last-font-height-info)) (cdr posframe--last-font-height-info) - (let ((height (when (integerp position) - (if (= position 1) - (default-line-height) - (aref (font-info - (font-at - (if (and (= position (point-max))) - (- position 1) - position))) - 3))))) + (let* ((font (font-at (if (and (= position (point-max))) + (- position 1) + position))) + (height (when (integerp position) + (if (or (= position 1) (not (fontp font))) + (default-line-height) + (aref (font-info font) 3))))) (setq posframe--last-font-height-info (cons position height)) height)))