about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--exwm-config.el6
-rw-r--r--exwm-floating.el4
-rw-r--r--exwm-input.el14
-rw-r--r--exwm-layout.el19
-rw-r--r--exwm-workspace.el8
-rw-r--r--exwm.el2
6 files changed, 27 insertions, 26 deletions
diff --git a/exwm-config.el b/exwm-config.el
index 5742cac18745..89320bc1e6eb 100644
--- a/exwm-config.el
+++ b/exwm-config.el
@@ -79,11 +79,11 @@
 
 You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
     (with-current-buffer (window-buffer (selected-window))
-      (if (and (eq major-mode 'exwm-mode)
+      (if (and (derived-mode-p 'exwm-mode)
                exwm--floating-frame)
           ;; Switch from a floating frame.
           (with-current-buffer buffer
-            (if (and (eq major-mode 'exwm-mode)
+            (if (and (derived-mode-p 'exwm-mode)
                      exwm--floating-frame
                      (eq exwm--frame exwm-workspace--current))
                 ;; Switch to another floating frame.
@@ -92,7 +92,7 @@ You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
               (or (get-buffer-window buffer exwm-workspace--current)
                   (selected-window))))
         (with-current-buffer buffer
-          (when (eq major-mode 'exwm-mode)
+          (when (derived-mode-p 'exwm-mode)
             (if (eq exwm--frame exwm-workspace--current)
                 (when exwm--floating-frame
                   ;; Switch to a floating frame on the current workspace.
diff --git a/exwm-floating.el b/exwm-floating.el
index 0210492b18e8..aa2f98822a2e 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -411,7 +411,7 @@ This is also used by X window containers.")
 (defun exwm-floating-hide ()
   "Hide the current floating X window (which would show again when selected)."
   (interactive)
-  (when (and (eq major-mode 'exwm-mode)
+  (when (and (derived-mode-p 'exwm-mode)
              exwm--floating-frame)
     (exwm-layout--hide exwm--id)
     (select-frame-set-input-focus exwm-workspace--current)))
@@ -641,7 +641,7 @@ This is also used by X window containers.")
   "Move a floating window right by DELTA-X pixels and down by DELTA-Y pixels.
 
 Both DELTA-X and DELTA-Y default to 1.  This command should be bound locally."
-  (unless (and (eq major-mode 'exwm-mode) exwm--floating-frame)
+  (unless (and (derived-mode-p 'exwm-mode) exwm--floating-frame)
     (user-error "[EXWM] `exwm-floating-move' is only for floating X windows"))
   (unless delta-x (setq delta-x 1))
   (unless delta-y (setq delta-y 1))
diff --git a/exwm-input.el b/exwm-input.el
index 55949aa1b29a..80ab352109a3 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -224,7 +224,7 @@ ARGS are additional arguments to CALLBACK."
               ;; The X window is on another workspace.
               (exwm-workspace-switch frame)
             (with-current-buffer buffer
-              (when (and (eq major-mode 'exwm-mode)
+              (when (and (derived-mode-p 'exwm-mode)
                          (not (eq exwm--frame exwm-workspace--current)))
                 ;; The floating X window is on another workspace.
                 (exwm-workspace-switch exwm--frame)))))
@@ -295,7 +295,7 @@ ARGS are additional arguments to CALLBACK."
   "Update input focus."
   (when (window-live-p window)
     (with-current-buffer (window-buffer window)
-      (if (eq major-mode 'exwm-mode)
+      (if (derived-mode-p 'exwm-mode)
           (if (not (eq exwm--frame exwm-workspace--current))
               (progn
                 (set-frame-parameter exwm--frame 'exwm-selected-window window)
@@ -369,14 +369,14 @@ ARGS are additional arguments to CALLBACK."
       (cond ((and (eq button-event exwm-input-move-event)
                   ;; Either an undecorated or a floating X window.
                   (with-current-buffer buffer
-                    (or (not (eq major-mode 'exwm-mode))
+                    (or (not (derived-mode-p 'exwm-mode))
                         exwm--floating-frame)))
              ;; Move
              (exwm-floating--start-moveresize
               event xcb:ewmh:_NET_WM_MOVERESIZE_MOVE))
             ((and (eq button-event exwm-input-resize-event)
                   (with-current-buffer buffer
-                    (or (not (eq major-mode 'exwm-mode))
+                    (or (not (derived-mode-p 'exwm-mode))
                         exwm--floating-frame)))
              ;; Resize
              (exwm-floating--start-moveresize event))
@@ -389,7 +389,7 @@ ARGS are additional arguments to CALLBACK."
                      ;; The X window is on another workspace
                      (exwm-workspace-switch frame)
                    (with-current-buffer buffer
-                     (when (and (eq major-mode 'exwm-mode)
+                     (when (and (derived-mode-p 'exwm-mode)
                                 (not (eq exwm--frame
                                          exwm-workspace--current)))
                        ;; The floating X window is on another workspace
@@ -410,7 +410,7 @@ ARGS are additional arguments to CALLBACK."
   "Handle KeyPress event."
   (let ((obj (make-instance 'xcb:KeyPress)))
     (xcb:unmarshal obj data)
-    (if (eq major-mode 'exwm-mode)
+    (if (derived-mode-p 'exwm-mode)
         (funcall exwm--on-KeyPress obj data)
       (exwm-input--on-KeyPress-char-mode obj))))
 
@@ -613,7 +613,7 @@ instead."
                                   exwm--connection (car keysym)
                                   (logand state (lognot (cdr keysym)))))
                  (setq event (exwm-input--mimic-read-event raw-event)))
-        (if (not (eq major-mode 'exwm-mode))
+        (if (not (derived-mode-p 'exwm-mode))
             (exwm-input--unread-event raw-event)
           ;; Grab keyboard temporarily.
           (setq exwm-input--temp-line-mode t)
diff --git a/exwm-layout.el b/exwm-layout.el
index b5685f417e62..1d3de291a78a 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -225,7 +225,7 @@ is t EXWM buffers are never selected by `other-buffer'.
 When variable `exwm-layout--other-buffer-exclude-buffers' is a
 list of buffers, EXWM buffers belonging to that list are never
 selected by `other-buffer'."
-  (or (not (eq 'exwm-mode (buffer-local-value 'major-mode buffer)))
+  (or (not (with-current-buffer buffer (derived-mode-p 'exwm-mode)))
       (and (not exwm-layout--other-buffer-exclude-exwm-mode-buffers)
            (not (memq buffer exwm-layout--other-buffer-exclude-buffers))
            ;; Do not select if already shown in some window.
@@ -268,7 +268,7 @@ selected by `other-buffer'."
             ;; Refresh a floating frame
             (let ((window (frame-first-window frame)))
               (with-current-buffer (window-buffer window)
-                (when (and (eq major-mode 'exwm-mode)
+                (when (and (derived-mode-p 'exwm-mode)
                            ;; It may be a buffer waiting to be killed.
                            (exwm--id->buffer exwm--id))
                   (exwm--log "Refresh floating window #x%x" exwm--id)
@@ -279,7 +279,7 @@ selected by `other-buffer'."
           (let ((exwm-layout--other-buffer-exclude-exwm-mode-buffers t))
             (dolist (window windows)
               (with-current-buffer (window-buffer window)
-                (when (eq major-mode 'exwm-mode)
+                (when (derived-mode-p 'exwm-mode)
                   (switch-to-prev-buffer window))))))
       ;; Refresh the whole workspace
       ;; Workspaces other than the active one can also be refreshed (RandR)
@@ -310,7 +310,8 @@ selected by `other-buffer'."
                                     (car-safe (window-prev-buffers window)))))
                   (and
                    prev-buffer
-                   (eq 'exwm-mode (buffer-local-value 'major-mode prev-buffer))
+                   (with-current-buffer prev-buffer
+                     (derived-mode-p 'exwm-mode))
                    (push prev-buffer covered-buffers))))))))
       ;; Set some sensible buffer to vacated windows.
       (let ((exwm-layout--other-buffer-exclude-buffers covered-buffers))
@@ -320,7 +321,7 @@ selected by `other-buffer'."
       (let ((exwm-layout--other-buffer-exclude-exwm-mode-buffers t))
         (dolist (window (window-list frame 0))
           (with-current-buffer (window-buffer window)
-            (when (and (eq major-mode 'exwm-mode)
+            (when (and (derived-mode-p 'exwm-mode)
                        (or exwm--floating-frame (not (eq frame exwm--frame))))
               (switch-to-prev-buffer window)))))
       (exwm-layout--set-client-list-stacking)
@@ -359,7 +360,7 @@ windows."
   (cond
    ((zerop delta))                     ;no operation
    ((window-minibuffer-p))             ;avoid resize minibuffer-window
-   ((not (and (eq major-mode 'exwm-mode) exwm--floating-frame))
+   ((not (and (derived-mode-p 'exwm-mode) exwm--floating-frame))
     ;; Resize on tiling layout
     (unless (= 0 (window-resizable nil delta horizontal nil t)) ;not resizable
       (let ((window-resize-pixelwise t))
@@ -461,7 +462,7 @@ See also `exwm-layout-enlarge-window'."
 (defun exwm-layout-hide-mode-line ()
   "Hide mode-line."
   (interactive)
-  (when (and (eq major-mode 'exwm-mode) mode-line-format)
+  (when (and (derived-mode-p 'exwm-mode) mode-line-format)
     (let (mode-line-height)
       (when exwm--floating-frame
         (setq mode-line-height (window-mode-line-height
@@ -479,7 +480,7 @@ See also `exwm-layout-enlarge-window'."
 (defun exwm-layout-show-mode-line ()
   "Show mode-line."
   (interactive)
-  (when (and (eq major-mode 'exwm-mode) (not mode-line-format))
+  (when (and (derived-mode-p 'exwm-mode) (not mode-line-format))
     (setq mode-line-format exwm--mode-line-format
           exwm--mode-line-format nil)
     (if (not exwm--floating-frame)
@@ -496,7 +497,7 @@ See also `exwm-layout-enlarge-window'."
 (defun exwm-layout-toggle-mode-line ()
   "Toggle the display of mode-line."
   (interactive)
-  (when (eq major-mode 'exwm-mode)
+  (when (derived-mode-p 'exwm-mode)
     (if mode-line-format
         (exwm-layout-hide-mode-line)
       (exwm-layout-show-mode-line))))
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 935d9d14a256..6535e11f27e3 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -506,7 +506,7 @@ for internal use only."
    (list
     (cond
      ((null current-prefix-arg)
-      (unless (and (eq major-mode 'exwm-mode)
+      (unless (and (derived-mode-p 'exwm-mode)
                    ;; The prompt is invisible in fullscreen mode.
                    (exwm-layout--fullscreen-p))
         (let ((exwm-workspace--prompt-add-allowed t)
@@ -644,7 +644,7 @@ Passing a workspace frame as the first option is for internal use only."
 (defun exwm-workspace-swap (workspace1 workspace2)
   "Interchange position of WORKSPACE1 with that of WORKSPACE2."
   (interactive
-   (unless (and (eq major-mode 'exwm-mode)
+   (unless (and (derived-mode-p 'exwm-mode)
                 ;; The prompt is invisible in fullscreen mode.
                 (exwm-layout--fullscreen-p))
      (let (w1 w2)
@@ -684,7 +684,7 @@ before it."
   (interactive
    (cond
     ((null current-prefix-arg)
-     (unless (and (eq major-mode 'exwm-mode)
+     (unless (and (derived-mode-p 'exwm-mode)
                   ;; The prompt is invisible in fullscreen mode.
                   (exwm-layout--fullscreen-p))
        (list exwm-workspace--current
@@ -921,7 +921,7 @@ INDEX must not exceed the current number of workspaces."
                  (rename-buffer (concat " " (buffer-name)))))))))))
   (when buffer-or-name
     (with-current-buffer buffer-or-name
-      (if (eq major-mode 'exwm-mode)
+      (if (derived-mode-p 'exwm-mode)
           ;; EXWM buffer.
           (if (eq exwm--frame exwm-workspace--current)
               ;; On the current workspace.
diff --git a/exwm.el b/exwm.el
index 17f73d8ca03b..33cced44a927 100644
--- a/exwm.el
+++ b/exwm.el
@@ -108,7 +108,7 @@
   "Reset the state of the selected window (non-fullscreen, line-mode, etc)."
   (interactive)
   (with-current-buffer (window-buffer)
-    (when (eq major-mode 'exwm-mode)
+    (when (derived-mode-p 'exwm-mode)
       (when (exwm-layout--fullscreen-p)
         (exwm-layout-unset-fullscreen))
       ;; Force refresh