[Top][All Lists]

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

[elpa] master 02b446a 27/33: posframe: Add initialize argument to posfra

From: Feng Shu
Subject: [elpa] master 02b446a 27/33: posframe: Add initialize argument to posframe-show
Date: Fri, 14 Dec 2018 06:21:18 -0500 (EST)

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

    posframe: Add initialize argument to posframe-show
    * posframe.el (posframe--initialize-p): New variable.
    (posframe-show): Add initialize argument
 posframe.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/posframe.el b/posframe.el
index d187629..b2f4fae 100644
--- a/posframe.el
+++ b/posframe.el
@@ -153,6 +153,8 @@ frame.")
 (defvar-local posframe--refresh-timer nil
   "Record the timer to deal with refresh argument of `posframe-show'.")
+(defvar-local posframe--initialize-p nil
+  "Record initialize status of `posframe-show'.")
 (cl-defun posframe--create-posframe (posframe-buffer
@@ -281,6 +283,7 @@ This posframe's buffer is POSFRAME-BUFFER."
+                         initialize
@@ -372,6 +375,10 @@ user can set FACE-REMAP, more setting details can be found:
   C-h v face-remapping-alist
+INITIALIZE is a function with no argument, it will run when
+posframe buffer is first selected with `with-current-buffer'
+in posframe-show, and only run once for speed reason.
 OVERRIDE-PARAMETERS is very powful, *all* the frame parameters
 used by posframe's frame can be overrided by it.
@@ -406,6 +413,13 @@ you can use `posframe-delete-all' to delete all posframes."
     (with-current-buffer posframe-buffer
+      ;; Initialize
+      (unless posframe--initialize-p
+        (when (functionp initialize)
+          (funcall initialize)
+          (setq posframe--initialize-p t)))
       ;; Move mouse to (0 . 0)
       (posframe--mouse-banish parent-frame)

reply via email to

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