diff options
author | Adrián Medraño Calvo <adrian@medranocalvo.com> | 2021-10-30T00·00+0000 |
---|---|---|
committer | Adrián Medraño Calvo <adrian@medranocalvo.com> | 2021-10-30T00·00+0000 |
commit | 1bc66b6438d7b62012de18c6a1a6992270f4e54c (patch) | |
tree | c3f624afddbc8e1dc4f94dc4a7c1f65a76a11b8d /exwm-workspace.el | |
parent | 52a0b1c5561c5bc8240bb2ea271e55659aff3981 (diff) | |
parent | d0b0b38c8709c9d429b3697aea30814717d802d7 (diff) |
Merge branch 'mattbeshara.github.com/less-consy-workspace--client-p' into externals/exwm
Diffstat (limited to 'exwm-workspace.el')
-rw-r--r-- | exwm-workspace.el | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/exwm-workspace.el b/exwm-workspace.el index 6fa7e9dca476..273ead7f0158 100644 --- a/exwm-workspace.el +++ b/exwm-workspace.el @@ -165,10 +165,21 @@ NIL if FRAME is not a workspace" "Return t if FRAME is a workspace." (memq frame exwm-workspace--list)) +(defvar exwm-workspace--client-p-hash-table + (make-hash-table :test 'eq :weakness 'key) + "Used to cache the results of calling ‘exwm-workspace--client-p’.") + (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-workspace--client-p-hash-table 'absent))) + (if (eq cached-value 'absent) + (puthash frame + (or (frame-parameter frame 'client) + (not (display-graphic-p frame))) + exwm-workspace--client-p-hash-table) + cached-value))) (defvar exwm-workspace--switch-map nil "Keymap used for interactively selecting workspace.") @@ -1458,7 +1469,8 @@ the next workspace." ;; care of converting a workspace into a regular unmanaged frame. (let ((exwm-workspace--create-silently t)) (make-frame))) - (exwm-workspace--remove-frame-as-workspace frame)))) + (exwm-workspace--remove-frame-as-workspace frame) + (remhash frame exwm--client-p-hash-table)))) (defun exwm-workspace--on-after-make-frame (frame) "Hook run upon `make-frame' that configures FRAME as a workspace." |