emacs-exwm / exwm

Emacs X Window Manager
https://elpa.gnu.org/packages/exwm.html
GNU General Public License v3.0
284 stars 14 forks source link

Make minor-modes idempotent #47

Closed Stebalien closed 5 months ago

Stebalien commented 5 months ago

Invoking the minor modes twice attempts to enable them twice, which raises an error (for some of them at least). I ran into this because I configure the minor modes via:

(use-package exwm
  :custom
  (exwm-systemtray-mode t)
  (exwm-xsettings-mode t)
  ;; etc...
)

Re-evaluating this configuration snippet should usually be safe. But at the moment, it's hitting:

(cl-assert (not exwm-systemtray--connection))

In exwm-sytemtray-mode.


Fixes:

  1. Instead of asserting, we can cl-return. Although there's nothing to assert in exwm-randr--init.
  2. We could add a separate "initialized" variable to prevent double initialization.

(really, I'm not sure why emacs doesn't handle this for us...)