From d41de490e3a63f8da8f11ed4cbde9d849490abda Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Thu, 6 Jun 2024 10:04:44 +0200 Subject: [PATCH] exwm-systemtray--init, exwm-xsettings--init: Idempotent initialization * exwm-systemtray.el (exwm-systemtray--init), exwm-xsettings.el (exwm-xsettings--init): Return early if already initialized. --- exwm-systemtray.el | 4 +++- exwm-xsettings.el | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/exwm-systemtray.el b/exwm-systemtray.el index 4f02a78..9ad29ac 100644 --- a/exwm-systemtray.el +++ b/exwm-systemtray.el @@ -491,7 +491,9 @@ Argument DATA contains the raw event data." (cl-defun exwm-systemtray--init () "Initialize system tray module." (exwm--log) - (cl-assert (not exwm-systemtray--connection)) + ;; idempotent initialization + (when exwm-systemtray--connection + (cl-return-from exwm-systemtray--init)) (cl-assert (not exwm-systemtray--list)) (cl-assert (not exwm-systemtray--selection-owner-window)) (cl-assert (not exwm-systemtray--embedder-window)) diff --git a/exwm-xsettings.el b/exwm-xsettings.el index 242819f..985c273 100644 --- a/exwm-xsettings.el +++ b/exwm-xsettings.el @@ -238,7 +238,9 @@ SERIAL is a sequence number." "Initialize the XSETTINGS module." (exwm--log) - (cl-assert (not exwm-xsettings--connection)) + ;; idempotent initialization + (when exwm-xsettings--connection + (cl-return-from exwm-xsettings--init)) ;; Connect (setq exwm-xsettings--connection (xcb:connect))