From 16d643dd3b2b8e468dbbfb2ad03d7abe41fdf94d Mon Sep 17 00:00:00 2001 From: Chris Feng Date: Sun, 15 Sep 2019 00:00:00 +0000 Subject: [PATCH] Fix timestamp for debug logs * exwm-core.el (exwm-debug-log-time-function): Moved to `exwm-debug' group and set `xcb-debug:log-time-function' automatically. (exwm-debug-log-uptime, exwm-debug-log-time): Reuse the definition from XELB. --- exwm-core.el | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/exwm-core.el b/exwm-core.el index b0a6839..9e28291 100644 --- a/exwm-core.el +++ b/exwm-core.el @@ -40,19 +40,22 @@ Here are some predefined candidates: `exwm-debug-log-uptime': Display the uptime of this Emacs instance. `exwm-debug-log-time': Display time of day. `nil': Disable timestamp." - :group 'exwm + :group 'exwm-debug :type `(choice (const :tag "Emacs uptime" ,#'exwm-debug-log-uptime) (const :tag "Time of day" ,#'exwm-debug-log-time) (const :tag "Off" nil) - (function :tag "Other"))) + (function :tag "Other")) + :set (lambda (symbol value) + (set-default symbol value) + ;; Also change the format for XELB to make logs consistent + ;; (as they share the same buffer). + (setq xcb-debug:log-time-function value))) -(defun exwm-debug-log-uptime () - "Add uptime to `exwm-debug' logs." - (emacs-uptime "[%.2h:%.2m:%.2s] ")) +(defalias 'exwm-debug-log-uptime 'xcb-debug:log-uptime + "Add uptime to `exwm-debug' logs.") -(defun exwm-debug-log-time () - "Add time of day to `exwm-debug' logs." - (format-time-string "[%T] ")) +(defalias 'exwm-debug-log-time 'xcb-debug:log-time + "Add time of day to `exwm-debug' logs.") (defvar exwm--connection nil "X connection.")