emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/posframe 2e89f6b 03/13: Make posframe work for `emacs -


From: Feng Shu
Subject: [elpa] externals/posframe 2e89f6b 03/13: Make posframe work for `emacs -nw`
Date: Sat, 8 Jun 2019 19:42:27 -0400 (EDT)

branch: externals/posframe
commit 2e89f6b5ebc158f048afecb5f30e9b24dc0477be
Author: Mark A. Hershberger <address@hidden>
Commit: Mark A. Hershberger <address@hidden>

    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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]