branch: externals/exwm
commit d0c88bcdca9d71eb9f91d533cc8ecd2542e6e8b9
Author: Steven Allen <[email protected]>
Commit: Steven Allen <[email protected]>

    Use with-slots to improve readability
    
    Where equivalent, use with-slots to reduce the noise of `slot-value' forms.
    
    * exwm-input.el (exwm-input--on-PropertyNotify): Use with-slots.
    * exwm-manage.el (exwm-manage--on-DestroyNotify): Use with-slots.
    * exwm.el (exwm--on-SelectionClear): Use with-slots.
---
 exwm-input.el  | 8 ++++----
 exwm-manage.el | 6 +++---
 exwm.el        | 6 ++----
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index c84a489ff1..8e91b38eef 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -227,11 +227,11 @@ ARGS are additional arguments to CALLBACK."
   "Handle PropertyNotify events with DATA."
   (exwm--log)
   (when exwm-input--timestamp-callback
-    (let ((obj (xcb:unmarshal-new 'xcb:PropertyNotify data)))
-      (when (= exwm-input--timestamp-window
-               (slot-value obj 'window))
+    (with-slots (window time)
+        (xcb:unmarshal-new 'xcb:PropertyNotify data)
+      (when (= exwm-input--timestamp-window window)
         (apply (car exwm-input--timestamp-callback)
-               (slot-value obj 'time)
+               time
                (cdr exwm-input--timestamp-callback))
         (setq exwm-input--timestamp-callback nil)))))
 
diff --git a/exwm-manage.el b/exwm-manage.el
index ec1a090f3b..d8b18bae9d 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -809,9 +809,9 @@ DATA contains unmarshalled DestroyNotify event data.
 SYNTHETIC indicates whether the event is a synthetic event."
   (unless synthetic
     (exwm--log)
-    (let ((obj (xcb:unmarshal-new 'xcb:DestroyNotify data)))
-      (exwm--log "#x%x" (slot-value obj 'window))
-      (exwm-manage--unmanage-window (slot-value obj 'window)))))
+    (with-slots (window) (xcb:unmarshal-new 'xcb:DestroyNotify data)
+      (exwm--log "#x%x" window)
+      (exwm-manage--unmanage-window window))))
 
 (defun exwm-manage--init ()
   "Initialize manage module."
diff --git a/exwm.el b/exwm.el
index 3d863066cd..6728d4949e 100644
--- a/exwm.el
+++ b/exwm.el
@@ -800,10 +800,8 @@ RAW-DATA contains unmarshalled ClientMessage event data."
   "Handle SelectionClear events.
 DATA contains unmarshalled SelectionClear event data."
   (exwm--log)
-  (let ((obj (xcb:unmarshal-new 'xcb:SelectionClear data))
-        owner selection)
-    (setq owner (slot-value obj 'owner)
-          selection (slot-value obj 'selection))
+  (with-slots (owner selection)
+      (xcb:unmarshal-new 'xcb:SelectionClear data)
     (when (and (eq owner exwm--wmsn-window)
                (eq selection xcb:Atom:WM_S0))
       (exwm-wm-mode -1))))

Reply via email to