Simplify debugging and fix dynamic-scoping `eval'
* exwm-core.el (exwm-debug): New global minor mode to replace `exwm-debug-on' and `exwm-debug-toggle'. * exwm-manage.el (exwm-manage--get-configurations): Use lexical-scoping `eval'.
This commit is contained in:
parent
5903080b6e
commit
472f7cb82b
2 changed files with 7 additions and 15 deletions
20
exwm-core.el
20
exwm-core.el
|
@ -68,10 +68,12 @@
|
|||
(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.")
|
||||
(define-minor-mode exwm-debug
|
||||
"Debug-logging enabled if non-nil"
|
||||
:global t)
|
||||
|
||||
(defmacro exwm--debug (&rest forms)
|
||||
(when exwm-debug-on `(progn ,@forms)))
|
||||
(when exwm-debug `(progn ,@forms)))
|
||||
|
||||
(defmacro exwm--log (&optional format-string &rest objects)
|
||||
"Emit a message prepending the name of the function being executed.
|
||||
|
@ -79,22 +81,12 @@
|
|||
FORMAT-STRING is a string specifying the message to output, as in
|
||||
`format'. The OBJECTS arguments specify the substitutions."
|
||||
(unless format-string (setq format-string ""))
|
||||
`(when exwm-debug-on
|
||||
`(when exwm-debug
|
||||
(xcb-debug:message ,(concat "%s:\t" format-string "\n")
|
||||
(xcb-debug:compile-time-function-name)
|
||||
,@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)))
|
||||
|
@ -201,7 +193,7 @@ least SECS seconds later."
|
|||
(let ((map (make-sparse-keymap)))
|
||||
(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-t" #'exwm-debug-toggle)
|
||||
(define-key map "\C-c\C-d\C-t" #'exwm-debug)
|
||||
(define-key map "\C-c\C-f" #'exwm-layout-set-fullscreen)
|
||||
(define-key map "\C-c\C-h" #'exwm-floating-hide)
|
||||
(define-key map "\C-c\C-k" #'exwm-input-release-keyboard)
|
||||
|
|
|
@ -182,7 +182,7 @@ You can still make the X windows floating afterwards."
|
|||
(when (derived-mode-p 'exwm-mode)
|
||||
(dolist (i exwm-manage-configurations)
|
||||
(save-current-buffer
|
||||
(when (eval (car i))
|
||||
(when (eval (car i) t)
|
||||
(cl-return-from exwm-manage--get-configurations (cdr i)))))))
|
||||
|
||||
(defun exwm-manage--manage-window (id)
|
||||
|
|
Loading…
Reference in a new issue