[Top][All Lists]

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

[elpa] master 08ef38d 29/33: posframe: Add posframe-default-initialize-f

From: Feng Shu
Subject: [elpa] master 08ef38d 29/33: posframe: Add posframe-default-initialize-function
Date: Fri, 14 Dec 2018 06:21:18 -0500 (EST)

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

    posframe: Add posframe-default-initialize-function
    * posframe.el (posframe-default-initialize-function): New variable,
      user can use this function to set posframe buffer globally.
 posframe.el | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/posframe.el b/posframe.el
index b629596..bb10ef5 100644
--- a/posframe.el
+++ b/posframe.el
@@ -123,6 +123,13 @@
   :group 'posframe
   :type 'boolean)
+(defcustom posframe-default-initialize-function nil
+  "The default :initialize function of `posframe-show'.
+If :initialize argument of `posframe-show' is nil, this function
+will be called as fallback."
+  :type 'function)
 (defvar-local posframe--frame nil
   "Record posframe's frame.")
@@ -377,7 +384,9 @@ user can set FACE-REMAP, more setting details can be found:
 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.
+in posframe-show, and only run once for speed reason, If INITIALIZE
+is nil, `posframe-default-initialize-function' will be used as
+fallback, user can use this variable to global set posframe buffer.
 OVERRIDE-PARAMETERS is very powful, *all* the frame parameters
 used by posframe's frame can be overrided by it.
@@ -416,9 +425,10 @@ you can use `posframe-delete-all' to delete all posframes."
       ;; Initialize
       (unless posframe--initialized-p
-        (when (functionp initialize)
-          (funcall initialize)
-          (setq posframe--initialized-p t)))
+        (let ((func (or initialize posframe-default-initialize-function)))
+          (when (functionp func)
+            (funcall func)
+            (setq posframe--initialized-p t))))
       ;; Move mouse to (0 . 0)
       (posframe--mouse-banish parent-frame)

reply via email to

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