mirror of
https://github.com/emacs-exwm/exwm.git
synced 2024-11-27 06:48:00 +01:00
; Unimportant tweaks
This commit is contained in:
parent
33dec8d1a3
commit
b6a3b7b3ad
3 changed files with 14 additions and 20 deletions
|
@ -33,9 +33,6 @@
|
||||||
(require 'xcb-ewmh)
|
(require 'xcb-ewmh)
|
||||||
(require 'exwm-debug)
|
(require 'exwm-debug)
|
||||||
|
|
||||||
(eval-and-compile
|
|
||||||
(defvar exwm-debug-on nil "Non-nil to turn on debug for EXWM."))
|
|
||||||
|
|
||||||
(defvar exwm--connection nil "X connection.")
|
(defvar exwm--connection nil "X connection.")
|
||||||
|
|
||||||
(defvar exwm--wmsn-window nil
|
(defvar exwm--wmsn-window nil
|
||||||
|
@ -294,8 +291,8 @@ least SECS seconds later."
|
||||||
|
|
||||||
(exwm--debug
|
(exwm--debug
|
||||||
(let ((map exwm-mode-map))
|
(let ((map exwm-mode-map))
|
||||||
(define-key map "\C-c\C-l" #'exwm-debug--clear)
|
(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-m" #'exwm-debug-mark)))
|
||||||
|
|
||||||
(define-derived-mode exwm-mode nil "EXWM"
|
(define-derived-mode exwm-mode nil "EXWM"
|
||||||
"Major mode for managing X windows.
|
"Major mode for managing X windows.
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
;;; exwm-debug.el --- Debugging helpers for EXWM -*- lexical-binding: t -*-
|
;;; exwm-debug.el --- Debugging helpers for EXWM -*- lexical-binding: t -*-
|
||||||
|
|
||||||
;; Copyright (C) 2015-2016 Free Software Foundation, Inc.
|
;; Copyright (C) 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
;; Author: Adrián Medraño Calvo <adrian@medranocalvo.com>
|
||||||
;; Adrián Medraño Calvo <adrian@medranocalvo.com>
|
|
||||||
|
|
||||||
;; This file is part of GNU Emacs.
|
;; This file is part of GNU Emacs.
|
||||||
|
|
||||||
|
@ -29,18 +28,16 @@
|
||||||
(eval-and-compile
|
(eval-and-compile
|
||||||
(defvar exwm-debug-on nil "Non-nil to turn on debug for EXWM."))
|
(defvar exwm-debug-on nil "Non-nil to turn on debug for EXWM."))
|
||||||
|
|
||||||
(defvar exwm-debug-buffer
|
(defvar exwm-debug-buffer "*EXWM-DEBUG*" "Buffer to write debug messages to.")
|
||||||
(when exwm-debug-on
|
|
||||||
(let ((buffer (get-buffer-create "*EXWM-DEBUG*")))
|
(defvar exwm-debug-backtrace-start-frame 5
|
||||||
(buffer-disable-undo buffer)
|
"From which frame to start collecting backtraces.")
|
||||||
buffer))
|
|
||||||
"Buffer to write debug messages to.")
|
|
||||||
|
|
||||||
(defun exwm-debug--call-stack ()
|
(defun exwm-debug--call-stack ()
|
||||||
"Return the current call stack frames."
|
"Return the current call stack frames."
|
||||||
(let (frames frame
|
(let (frames frame
|
||||||
;; No need to acount for our setq, while, let, ...
|
;; No need to acount for our setq, while, let, ...
|
||||||
(index 5))
|
(index exwm-debug-backtrace-start-frame))
|
||||||
(while (setq frame (backtrace-frame index))
|
(while (setq frame (backtrace-frame index))
|
||||||
(push frame frames)
|
(push frame frames)
|
||||||
(cl-incf index))
|
(cl-incf index))
|
||||||
|
@ -64,7 +61,7 @@
|
||||||
|
|
||||||
(defmacro exwm-debug--with-debug-buffer (&rest forms)
|
(defmacro exwm-debug--with-debug-buffer (&rest forms)
|
||||||
"Evaluate FORMS making sure `exwm-debug-buffer' is correctly updated."
|
"Evaluate FORMS making sure `exwm-debug-buffer' is correctly updated."
|
||||||
`(with-current-buffer exwm-debug-buffer
|
`(with-current-buffer (get-buffer-create exwm-debug-buffer)
|
||||||
(let (windows-eob)
|
(let (windows-eob)
|
||||||
;; Note windows whose point is at EOB.
|
;; Note windows whose point is at EOB.
|
||||||
(dolist (w (get-buffer-window-list exwm-debug-buffer t t))
|
(dolist (w (get-buffer-window-list exwm-debug-buffer t t))
|
||||||
|
@ -97,13 +94,13 @@ the passed OBJECTS. See `format' for details."
|
||||||
(debugger (lambda (&rest _) (exwm-debug--backtrace))))
|
(debugger (lambda (&rest _) (exwm-debug--backtrace))))
|
||||||
,@forms))
|
,@forms))
|
||||||
|
|
||||||
(defun exwm-debug--clear ()
|
(defun exwm-debug-clear ()
|
||||||
"Clear the debug buffer."
|
"Clear the debug buffer."
|
||||||
(interactive)
|
(interactive)
|
||||||
(exwm-debug--with-debug-buffer
|
(exwm-debug--with-debug-buffer
|
||||||
(erase-buffer)))
|
(erase-buffer)))
|
||||||
|
|
||||||
(defun exwm-debug--mark ()
|
(defun exwm-debug-mark ()
|
||||||
"Insert a mark in the debug buffer."
|
"Insert a mark in the debug buffer."
|
||||||
(interactive)
|
(interactive)
|
||||||
(exwm-debug--with-debug-buffer
|
(exwm-debug--with-debug-buffer
|
||||||
|
|
|
@ -377,7 +377,7 @@ ARGS are additional arguments to CALLBACK."
|
||||||
button-event window buffer frame)
|
button-event window buffer frame)
|
||||||
(xcb:unmarshal obj data)
|
(xcb:unmarshal obj data)
|
||||||
(exwm--log "major-mode=%s buffer=%s"
|
(exwm--log "major-mode=%s buffer=%s"
|
||||||
major-mode (buffer-name (current-buffer)))
|
major-mode (buffer-name (current-buffer)))
|
||||||
(with-slots (detail time event state) obj
|
(with-slots (detail time event state) obj
|
||||||
(setq button-event (xcb:keysyms:keysym->event exwm--connection
|
(setq button-event (xcb:keysyms:keysym->event exwm--connection
|
||||||
detail state)
|
detail state)
|
||||||
|
@ -428,7 +428,7 @@ ARGS are additional arguments to CALLBACK."
|
||||||
(let ((obj (make-instance 'xcb:KeyPress)))
|
(let ((obj (make-instance 'xcb:KeyPress)))
|
||||||
(xcb:unmarshal obj data)
|
(xcb:unmarshal obj data)
|
||||||
(exwm--log "major-mode=%s buffer=%s"
|
(exwm--log "major-mode=%s buffer=%s"
|
||||||
major-mode (buffer-name (current-buffer)))
|
major-mode (buffer-name (current-buffer)))
|
||||||
(if (derived-mode-p 'exwm-mode)
|
(if (derived-mode-p 'exwm-mode)
|
||||||
(funcall exwm--on-KeyPress obj data)
|
(funcall exwm--on-KeyPress obj data)
|
||||||
(exwm-input--on-KeyPress-char-mode obj))))
|
(exwm-input--on-KeyPress-char-mode obj))))
|
||||||
|
|
Loading…
Reference in a new issue