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

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

[elpa] master f88138f 03/33: posframe: Add posframe--last-poshandler-inf


From: Feng Shu
Subject: [elpa] master f88138f 03/33: posframe: Add posframe--last-poshandler-info
Date: Fri, 14 Dec 2018 06:21:13 -0500 (EST)

branch: master
commit f88138f4763136da3e8122c9720cfaf252c7337a
Author: Feng Shu <address@hidden>
Commit: Feng Shu <address@hidden>

    posframe: Add posframe--last-poshandler-info
    
    * posframe.el (posframe--last-poshandler-info): New variable
    (posframe-run-poshandler): Use posframe--last-poshandler-info to cache
---
 posframe.el | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/posframe.el b/posframe.el
index 628aa9a..4b76901 100644
--- a/posframe.el
+++ b/posframe.el
@@ -120,6 +120,9 @@
 (defvar-local posframe--last-parent-frame-size nil
   "Record the last size of posframe's parent-frame.")
 
+(defvar-local posframe--last-poshandler-info nil
+  "Record the last poshandler info.")
+
 (defvar-local posframe--last-args nil
   "Record the last arguments of `posframe--create-posframe'.
 
@@ -552,17 +555,20 @@ This function is used by `kill-buffer-hook'."
 
 the structure of INFO can be found in docstring
 of `posframe-show'."
-  (funcall
-   (or (plist-get info :poshandler)
-       (let ((position (plist-get info :position)))
-         (cond ((integerp position)
-                #'posframe-poshandler-point-bottom-left-corner)
-               ((and (consp position)
-                     (integerp (car position))
-                     (integerp (cdr position)))
-                #'posframe-poshandler-absolute-x-y)
-               (t (error "Posframe: have no valid poshandler")))))
-   info))
+  (if (equal info posframe--last-poshandler-info)
+      posframe--last-posframe-pixel-position
+    (setq posframe--last-poshandler-info info)
+    (funcall
+     (or (plist-get info :poshandler)
+         (let ((position (plist-get info :position)))
+           (cond ((integerp position)
+                  #'posframe-poshandler-point-bottom-left-corner)
+                 ((and (consp position)
+                       (integerp (car position))
+                       (integerp (cdr position)))
+                  #'posframe-poshandler-absolute-x-y)
+                 (t (error "Posframe: have no valid poshandler")))))
+     info)))
 
 (defun posframe-poshandler-absolute-x-y (info)
   "Posframe's position hanlder.



reply via email to

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