diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-23 03:35:17 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-23 03:35:17 -0500 |
| commit | 14ec32b223608c8c507b4743ea7aa9c742d30d75 (patch) | |
| tree | a9e6594a858f56c87300bb932a757b812e6d536d /modules | |
| parent | 62a6b88bb3706c890b511e484e26f6fb4756eecb (diff) | |
| download | dotemacs-14ec32b223608c8c507b4743ea7aa9c742d30d75.tar.gz dotemacs-14ec32b223608c8c507b4743ea7aa9c742d30d75.zip | |
refactor(host-env): fix env-desktop-p doc and normalize the X predicates
env-desktop-p's docstring described a laptop, but the function returns t for the desktop case (no battery). env-x-p compared the window system against the string "x" while its sibling env-x11-p used `eq` against the symbol, so the two read differently for the same check.
I corrected the docstring and switched env-x-p to the symbol comparison. I also spelled out the difference between env-x-p (any X display, including XWayland) and env-x11-p (a real X11 session, no Wayland). Behavior is unchanged, so the existing display-predicate tests stay green.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/host-environment.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/modules/host-environment.el b/modules/host-environment.el index 154c5d04..e9887766 100644 --- a/modules/host-environment.el +++ b/modules/host-environment.el @@ -45,7 +45,7 @@ canonical signal. On other platforms, falls back to `battery-format' (battery-format "%B" (funcall battery-status-function)))))) (defun env-desktop-p () - "Return t if host is a laptop (has a battery), nil if not." + "Return t if host is a desktop (no battery), nil if it has one." (when (not (env-laptop-p)) t)) @@ -66,11 +66,14 @@ canonical signal. On other platforms, falls back to `battery-format' (memq system-type '(cygwin windows-nt ms-dos))) (defun env-x-p () - "Return t if host system is running the X Window System." - (string= (window-system) "x")) + "Return t if the frame uses an X display, including XWayland. +Compare `env-x11-p', which is t only in a real X11 session and nil under +Wayland/XWayland. Uses symbol comparison to match `env-x11-p' style." + (eq (window-system) 'x)) (defun env-x11-p () - "Return t if running under X11 (not Wayland)." + "Return t in a real X11 session: an X display with no WAYLAND_DISPLAY. +Compare `env-x-p', which is also t under XWayland (X display, Wayland set)." (and (eq (window-system) 'x) (not (getenv "WAYLAND_DISPLAY")))) |
