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

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

[elpa] externals/posframe 475a1b30c6 1/3: Remove kill-buffer-hook.


From: ELPA Syncer
Subject: [elpa] externals/posframe 475a1b30c6 1/3: Remove kill-buffer-hook.
Date: Fri, 7 Jan 2022 18:57:40 -0500 (EST)

branch: externals/posframe
commit 475a1b30c6523cfb419f08b9cb25e4e45275e5ef
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    Remove kill-buffer-hook.
    
            * posframe.el (posframe-auto-hide): Removed.
            (posframe--create-posframe): Do not set kill-buffer-hook and window 
dedicate.
            (posframe-hidehandler-daemon-function): Hide frame when buffer is 
not live.
---
 posframe.el | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/posframe.el b/posframe.el
index cfb47855ff..d128ba8fd0 100644
--- a/posframe.el
+++ b/posframe.el
@@ -163,7 +163,8 @@ ACCEPT-FOCUS."
         (buffer (get-buffer-create buffer-or-name))
         (after-make-frame-functions nil)
         (x-gtk-resize-child-frames posframe-gtk-resize-child-frames)
-        (args (list foreground-color
+        (args (list "args"
+                    foreground-color
                     background-color
                     right-fringe
                     left-fringe
@@ -200,18 +201,12 @@ ACCEPT-FOCUS."
       (unless respect-header-line
         (setq-local header-line-format nil))
 
-      ;; When buffer is killed, posframe will be hided instead of
-      ;; deleted, the reason is that the hide posframe can be re-used
-      ;; when the buffer is created again.
-      (add-hook 'kill-buffer-hook #'posframe-auto-hide nil t)
-
       ;; Find existing posframe: Sometimes, the buffer of posframe
       ;; will be recreated by other packages, so we should find
       ;; existing posframe first if possible.
       (unless (or posframe--frame posframe--last-args)
         (setq-local posframe--frame
-                    (posframe--find-existing-posframe
-                     buffer-or-name args))
+                    (posframe--find-existing-posframe buffer args))
         (setq-local posframe--last-args args))
 
       ;; Create child-frame
@@ -1017,14 +1012,14 @@ BUFFER-OR-NAME can be a buffer or a buffer name."
               (cancel-timer timer)))))
       (delete-frame posframe))))
 
-(defun posframe--find-existing-posframe (buffer-or-name &optional last-args)
-  "Find existing posframe with BUFFER-OR-NAME and LAST-ARGS."
+(defun posframe--find-existing-posframe (buffer &optional last-args)
+  "Find existing posframe with BUFFER and LAST-ARGS."
   (cl-find-if
    (lambda (frame)
      (let* ((buffer-info (frame-parameter frame 'posframe-buffer))
             (buffer-equal-p
-             (or (equal buffer-or-name (car buffer-info))
-                 (equal buffer-or-name (cdr buffer-info)))))
+             (or (equal (buffer-name buffer) (car buffer-info))
+                 (equal buffer (cdr buffer-info)))))
        (if last-args
            (and buffer-equal-p
                 (equal last-args (frame-parameter frame 'last-args)))
@@ -1068,12 +1063,6 @@ BUFFER-OR-NAME can be a buffer or a buffer name."
       (when posframe--frame
         (posframe--kill-buffer buffer)))))
 
-(defun posframe-auto-hide ()
-  "Auto hide posframe when its buffer is killed.
-
-This function is used by `kill-buffer-hook'."
-  (posframe-delete-frame (current-buffer)))
-
 ;; Posframe's position handler
 (defun posframe-run-poshandler (info)
   "Run posframe's position handler.



reply via email to

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