about summary refs log tree commit diff
path: root/exwm-core.el
diff options
context:
space:
mode:
authorAdrián Medraño Calvo <adrian@medranocalvo.com>2018-09-04T12·00+0000
committerAdrián Medraño Calvo <adrian@medranocalvo.com>2018-09-04T12·00+0000
commitac1372eb1154a536e32096befa4c975c814c813c (patch)
tree644d6f2fd2db6646fa433672a8c0b0c5d29533b4 /exwm-core.el
parent3419337f52b7aaa820670e8b393f4f1db9079372 (diff)
Command for toggling debugging output
* exwm-core.el (exwm-debug-toggle): New function for toggling
debugging output.
(exwm-mode-map): Use it.
Diffstat (limited to 'exwm-core.el')
-rw-r--r--exwm-core.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/exwm-core.el b/exwm-core.el
index 2d74abadae60..49914d3e2c9d 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -85,6 +85,16 @@ FORMAT-STRING is a string specifying the message to output, as in
                         ,@objects)
      nil))
 
+(defun exwm-debug-toggle (&optional arg)
+  "Toggle EXWM debugging output.
+When ARG is positive, turn debugging on; when negative off.  When
+ARG is nil, toggle debugging output."
+  (interactive
+   (list (or current-prefix-arg 'toggle)))
+  (setq exwm-debug-on (if (eq arg 'toggle)
+                          (not exwm-debug-on)
+                        (> 0 arg))))
+
 (defsubst exwm--id->buffer (id)
   "X window ID => Emacs buffer."
   (cdr (assoc id exwm--id-buffer-alist)))
@@ -293,7 +303,8 @@ least SECS seconds later."
 (exwm--debug
   (let ((map exwm-mode-map))
     (define-key map "\C-c\C-d\C-l" #'xcb-debug-clear)
-    (define-key map "\C-c\C-d\C-m" #'xcb-debug-mark)))
+    (define-key map "\C-c\C-d\C-m" #'xcb-debug-mark)
+    (define-key map "\C-c\C-d\C-t" #'exwm-debug-toggle)))
 
 (define-derived-mode exwm-mode nil "EXWM"
   "Major mode for managing X windows.