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
commit74ef19ff44104b0f056e30af90e0970eb705eb6a (patch)
tree5fb07a83435f5a93e702195ed08ac6e2b634a732 /exwm-core.el
parentdd57c5eebb213c29c3b250634e316abf4917a19b (diff)
Use XELB's debugging facilities
* exwm-debug.el: Move to XELB as `xcb-debug'.
* exwm-core.el (exwm--log): Use it.
(exwm--log): Support switching debugging output at runtime.
Diffstat (limited to 'exwm-core.el')
-rw-r--r--exwm-core.el27
1 files changed, 14 insertions, 13 deletions
diff --git a/exwm-core.el b/exwm-core.el
index 8d5e6dd6911f..de2c9de9f936 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -31,7 +31,7 @@
 (require 'xcb)
 (require 'xcb-icccm)
 (require 'xcb-ewmh)
-(require 'exwm-debug)
+(require 'xcb-debug)
 
 (defvar exwm--connection nil "X connection.")
 
@@ -68,21 +68,22 @@
 (declare-function exwm-workspace-move-window "exwm-workspace.el"
                   (frame-or-index &optional id))
 
+(defvar exwm-debug-on nil "Non-nil to turn on debug for EXWM.")
+
+(defmacro exwm--debug (&rest forms)
+  (when exwm-debug-on `(progn ,@forms)))
+
 (defmacro exwm--log (&optional format-string &rest objects)
   "Emit a message prepending the name of the function being executed.
 
 FORMAT-STRING is a string specifying the message to output, as in
 `format'.  The OBJECTS arguments specify the substitutions."
-  (when exwm-debug-on
-    (unless format-string (setq format-string ""))
-    `(progn
-       (exwm-debug--message (concat "%s:\t" ,format-string "\n")
-                            (exwm-debug--compile-time-function-name)
-                            ,@objects)
-       nil)))
-
-(defmacro exwm--debug (&rest forms)
-  (when exwm-debug-on `(progn ,@forms)))
+  (unless format-string (setq format-string ""))
+  `(when exwm-debug-on
+     (xcb-debug-message ,(concat "%s:\t" format-string "\n")
+                        (xcb-debug-compile-time-function-name)
+                        ,@objects)
+     nil))
 
 (defsubst exwm--id->buffer (id)
   "X window ID => Emacs buffer."
@@ -291,8 +292,8 @@ least SECS seconds later."
 
 (exwm--debug
   (let ((map exwm-mode-map))
-    (define-key map "\C-c\C-l" #'exwm-debug-clear)
-    (define-key map "\C-c\C-m" #'exwm-debug-mark)))
+    (define-key map "\C-c\C-l" #'xcb-debug-clear)
+    (define-key map "\C-c\C-m" #'xcb-debug-mark)))
 
 (define-derived-mode exwm-mode nil "EXWM"
   "Major mode for managing X windows.