[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/exwm 182ffbe 03/11: Use a hash table to cache result o
From: |
Adrián Medraño Calvo |
Subject: |
[elpa] externals/exwm 182ffbe 03/11: Use a hash table to cache result of ‘exwm-workspace--client-p’ |
Date: |
Sat, 13 Nov 2021 16:51:01 -0500 (EST) |
branch: externals/exwm
commit 182ffbed6c7334ee51cb5cd2645ba0ee42c4da13
Author: Matt Beshara <m@mfa.pw>
Commit: Adrián Medraño Calvo <adrian@medranocalvo.com>
Use a hash table to cache result of ‘exwm-workspace--client-p’
* exwm-workspace.el (exwm--client-p-hash-table): New variable.
(exwm-workspace--client-p): Use `exwm--client-p-hash-table' to
store which workspace frames are client frames instead of
frequently invoking `frame-parameter'.
---
exwm-workspace.el | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/exwm-workspace.el b/exwm-workspace.el
index cff17f3..c1de5da 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -165,10 +165,19 @@ NIL if FRAME is not a workspace"
"Return t if FRAME is a workspace."
(memq frame exwm-workspace--list))
+(defvar exwm--client-p-hash-table
+ (make-hash-table :test 'eq :weakness 'key))
+
(defsubst exwm-workspace--client-p (&optional frame)
"Return non-nil if FRAME is an emacsclient frame."
- (or (frame-parameter frame 'client)
- (not (display-graphic-p frame))))
+ (let* ((frame (or frame (selected-frame)))
+ (cached-value (gethash frame exwm--client-p-hash-table 'absent)))
+ (if (eq cached-value 'absent)
+ (puthash frame
+ (or (frame-parameter frame 'client)
+ (not (display-graphic-p frame)))
+ exwm--client-p-hash-table)
+ cached-value)))
(defvar exwm-workspace--switch-map nil
"Keymap used for interactively selecting workspace.")
- [elpa] externals/exwm updated (deabe9c -> 10bd122), Adrián Medraño Calvo, 2021/11/13
- [elpa] externals/exwm 8905e85 04/11: Rename variable using ‘exwm-workspace’ package prefix; add docstring, Adrián Medraño Calvo, 2021/11/13
- [elpa] externals/exwm 52a0b1c 06/11: Merge branch 'tumashu.github.com/master' into externals/exwm, Adrián Medraño Calvo, 2021/11/13
- [elpa] externals/exwm d0b0b38 05/11: Explicitly remove workspace frames from client-p cache when deleted, Adrián Medraño Calvo, 2021/11/13
- [elpa] externals/exwm 3d648ef 01/11: Add variable indicating XIM buffers, Adrián Medraño Calvo, 2021/11/13
- [elpa] externals/exwm 1863361 02/11: Merge branch 'tumashu.github.com/master' into externals/exwm, Adrián Medraño Calvo, 2021/11/13
- [elpa] externals/exwm 182ffbe 03/11: Use a hash table to cache result of ‘exwm-workspace--client-p’,
Adrián Medraño Calvo <=
- [elpa] externals/exwm 1bc66b6 07/11: Merge branch 'mattbeshara.github.com/less-consy-workspace--client-p' into externals/exwm, Adrián Medraño Calvo, 2021/11/13
- [elpa] externals/exwm 571ca22 08/11: Remove duplicate code, Adrián Medraño Calvo, 2021/11/13
- [elpa] externals/exwm 08f20ea 10/11: Fix previous commit "Remove duplicate code", Adrián Medraño Calvo, 2021/11/13
- [elpa] externals/exwm 10bd122 11/11: Bump version to 0.26, Adrián Medraño Calvo, 2021/11/13
- [elpa] externals/exwm 5098708 09/11: Correct wrong variable name, Adrián Medraño Calvo, 2021/11/13