Print log output to an EXWM-specific messages buffer
Using `message' to log debugging information is cumbersome, as the output appears constantly in the minibuffer, obscuring prompts and other information. In the case of long messages, it might resize the minibuffer, which causes EXWM to perform additional actions due to the log output. This change reimplements EXWM debug logging using a separate buffer (*EXWM-DEBUG*). Basic functionality, like scrolling when point is at the end of the buffer is maintained. * exwm-core.el (exwm--log): Use `exwm-debug--message' instead of `message'. Prefix all messages with the name of the function. Make FORMAT-STRING argument optional. * exwm-debug.el: New file. (exwm-debug-buffer): New variable holding the buffer where debug messages are output to. (exwm-debug--message): New function printing a message to `exwm-debug-buffer'. (exwm-debug--backtrace): New function printing a backtrace.
This commit is contained in:
parent
4d43e3119a
commit
8d15a39c4d
2 changed files with 116 additions and 3 deletions
15
exwm-core.el
15
exwm-core.el
|
|
@ -31,6 +31,7 @@
|
|||
(require 'xcb)
|
||||
(require 'xcb-icccm)
|
||||
(require 'xcb-ewmh)
|
||||
(require 'exwm-debug)
|
||||
|
||||
(eval-and-compile
|
||||
(defvar exwm-debug-on nil "Non-nil to turn on debug for EXWM."))
|
||||
|
|
@ -70,10 +71,18 @@
|
|||
(declare-function exwm-workspace-move-window "exwm-workspace.el"
|
||||
(frame-or-index &optional id))
|
||||
|
||||
(defmacro exwm--log (format-string &rest args)
|
||||
"Print debug message."
|
||||
(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
|
||||
`(message (concat "[EXWM] " ,format-string) ,@args)))
|
||||
(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)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue