[Top][All Lists]

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

[elpa] master 272ca09 10/33: Use posframe-hide-frame instead make-frame-

From: Feng Shu
Subject: [elpa] master 272ca09 10/33: Use posframe-hide-frame instead make-frame-invisible
Date: Fri, 14 Dec 2018 06:21:15 -0500 (EST)

branch: master
commit 272ca0966fe850e8598f7799f0e152e39e48371d
Author: Andy Stewart <address@hidden>
Commit: GitHub <address@hidden>

    Use posframe-hide-frame instead make-frame-invisible
    Hi, I'm AndyStewart from EmacsWiki, your posframe.el is awesome.
    I found posframe--run-timeout-timer will trigger error once developer use 
posframe-delete remove frame before posframe timer.
    Error running timer ‘make-frame-invisible’: (wrong-type-argument 
frame-live-p #<dead frame *sdcv* 0x63e7940>)
    I build a new function posframe-hide-frame instead make-frame-invisible 
that use frame-live-p check frame before delete.
 posframe.el | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/posframe.el b/posframe.el
index 5b06d0c..7a568e6 100644
--- a/posframe.el
+++ b/posframe.el
@@ -5,7 +5,7 @@
 ;; Author: Feng Shu <address@hidden>
 ;; Maintainer: Feng Shu <address@hidden>
 ;; URL: https://github.com/tumashu/posframe
-;; Version: 0.4.0
+;; Version: 0.4.1
 ;; Keywords: tooltip
 ;; Package-Requires: ((emacs "26"))
@@ -372,7 +372,7 @@ you can use `posframe-delete-all' to delete all posframes."
-        `(;All poshandlers will get info from this plist.
+        `(             ;All poshandlers will get info from this plist.
           :position ,position
           :poshandler ,poshandler
           :font-height ,font-height
@@ -475,7 +475,12 @@ This need PARENT-FRAME-WIDTH and PARENT-FRAME-HEIGHT"
       (cancel-timer posframe--timeout-timer))
     (setq-local posframe--timeout-timer
-                 secs nil #'make-frame-invisible posframe))))
+                 secs nil #'posframe-hide-frame posframe))))
+(defun posframe-hide-frame (frame)
+  "This function used to instead `make-frame-invisible' to make hide frame 
+  (when (frame-live-p frame)
+    (make-frame-invisible frame)))
 (defun posframe--run-refresh-timer (posframe repeat
                                              height min-height
@@ -503,7 +508,7 @@ WIDTH and MIN-WIDTH."
     (let ((buffer-info (frame-parameter frame 'posframe-buffer)))
       (when (or (equal posframe-buffer (car buffer-info))
                 (equal posframe-buffer (cdr buffer-info)))
-        (make-frame-invisible frame)))))
+        (posframe-hide-frame frame)))))
 (defun posframe-delete (posframe-buffer)
   "Delete posframe which buffer POSFRAME-BUFFER."
@@ -537,7 +542,7 @@ This posframe's buffer is POSFRAME-BUFFER."
   (dolist (frame (frame-list))
     (let ((buffer-info (frame-parameter frame 'posframe-buffer)))
-      (when buffer-info (make-frame-invisible frame)))))
+      (when buffer-info (posframe-hide-frame frame)))))
 (defun posframe-delete-all ()

reply via email to

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