[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ace-window e3e6ec105a 3/3: Fix slowness of posframe
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ace-window e3e6ec105a 3/3: Fix slowness of posframe |
Date: |
Tue, 6 Sep 2022 14:57:15 -0400 (EDT) |
branch: externals/ace-window
commit e3e6ec105ae8d18208f7a56fc1b068dd1427f1d4
Author: Mark Skilbeck <mark.skilbeck@rigetti.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
Fix slowness of posframe
Fixes #192
---
ace-window-posframe.el | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/ace-window-posframe.el b/ace-window-posframe.el
index 2937aeba3c..c28862ba13 100644
--- a/ace-window-posframe.el
+++ b/ace-window-posframe.el
@@ -4,8 +4,15 @@
(defun aw--lead-overlay-posframe (path leaf)
(let* ((wnd (cdr leaf))
- (str (apply #'string path))
- (bufname (format "*aw-posframe-buffer-%s*" (gensym))))
+ (str (format "%s" (apply #'string path)))
+ ;; It's important that buffer names are not unique across
+ ;; multiple invocations: posframe becomes very slow when
+ ;; creating new frames, and so being able to reuse old ones
+ ;; makes a huge difference. What defines "able to reuse" is
+ ;; something like: a frame exists which hasn't been deleted
+ ;; (with posframe-delete) and has the same configuration as
+ ;; the requested new frame.
+ (bufname (format "*aw-posframe-buffer-%s*" path)))
(with-selected-window wnd
(push bufname aw--posframe-frames)
(posframe-show bufname
@@ -16,7 +23,9 @@
:background-color (face-background
'aw-leading-char-face)))))
(defun aw--remove-leading-chars-posframe ()
- (map nil #'posframe-delete aw--posframe-frames))
+ ;; Hide rather than delete. See aw--lead-overlay-posframe for why.
+ (map nil #'posframe-hide aw--posframe-frames)
+ (setq aw--posframe-frames '()))
(defun ace-window-posframe-enable ()
(setq aw--lead-overlay-fn #'aw--lead-overlay-posframe