Move evaluated mode-name expression to exwm--mode-name

* exwm-core.el (exwm--mode-name): New function.
  (exwm-mode): Use it.
This commit is contained in:
Daniel Mendler 2024-03-16 16:53:04 +01:00
parent 61d97532fa
commit a959f91c75
No known key found for this signature in database
GPG key ID: D88ADB2A2693CA43

View file

@ -82,6 +82,7 @@ Here are some predefined candidates:
(defvar exwm-input--simulation-keys) (defvar exwm-input--simulation-keys)
(defvar exwm-input-line-mode-passthrough) (defvar exwm-input-line-mode-passthrough)
(defvar exwm-input-prefix-keys) (defvar exwm-input-prefix-keys)
(defvar exwm-workspace--list)
(declare-function exwm-input--fake-key "exwm-input.el" (event)) (declare-function exwm-input--fake-key "exwm-input.el" (event))
(declare-function exwm-input--on-KeyPress-line-mode "exwm-input.el" (declare-function exwm-input--on-KeyPress-line-mode "exwm-input.el"
(key-press raw-data)) (key-press raw-data))
@ -229,6 +230,14 @@ If CONN is non-nil, use it instead of the value of the variable
(setq ret-depth depth)) (setq ret-depth depth))
(list ret-visual ret-depth ret-colormap))) (list ret-visual ret-depth ret-colormap)))
(defun exwm--mode-name ()
"Mode name string used in `exwm-mode' buffers."
(let ((name "EXWM"))
(if (cl-some (lambda (i) (frame-parameter i 'exwm-urgency))
exwm-workspace--list)
(propertize name 'face 'font-lock-warning-face)
name)))
;; Internal variables ;; Internal variables
(defvar-local exwm--id nil) ;window ID (defvar-local exwm--id nil) ;window ID
(defvar-local exwm--configurations nil) ;initial configurations. (defvar-local exwm--configurations nil) ;initial configurations.
@ -382,12 +391,6 @@ One of `line-mode' or `char-mode'.")
\\{exwm-mode-map}" \\{exwm-mode-map}"
:interactive nil :abbrev-table nil :syntax-table nil :interactive nil :abbrev-table nil :syntax-table nil
(setq mode-name
'(:eval (propertize "EXWM" 'face
(when (cl-some (lambda (i)
(frame-parameter i 'exwm-urgency))
exwm-workspace--list)
'font-lock-warning-face))))
;; Change major-mode is not allowed ;; Change major-mode is not allowed
(add-hook 'change-major-mode-hook #'kill-buffer nil t) (add-hook 'change-major-mode-hook #'kill-buffer nil t)
;; Kill buffer -> close window ;; Kill buffer -> close window
@ -396,7 +399,8 @@ One of `line-mode' or `char-mode'.")
;; Redirect events when executing keyboard macros. ;; Redirect events when executing keyboard macros.
(push `(executing-kbd-macro . ,exwm--kmacro-map) (push `(executing-kbd-macro . ,exwm--kmacro-map)
minor-mode-overriding-map-alist) minor-mode-overriding-map-alist)
(setq buffer-read-only t (setq mode-name '(:eval (exwm--mode-name))
buffer-read-only t
cursor-type nil cursor-type nil
left-margin-width nil left-margin-width nil
right-margin-width nil right-margin-width nil