From b6a3b7b3ad67fe69d82d335e5520ba7368bab768 Mon Sep 17 00:00:00 2001 From: Chris Feng Date: Sun, 19 Aug 2018 00:00:00 +0000 Subject: [PATCH] ; Unimportant tweaks --- exwm-core.el | 7 ++----- exwm-debug.el | 23 ++++++++++------------- exwm-input.el | 4 ++-- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/exwm-core.el b/exwm-core.el index 3159519..8d5e6dd 100644 --- a/exwm-core.el +++ b/exwm-core.el @@ -33,9 +33,6 @@ (require 'xcb-ewmh) (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--wmsn-window nil @@ -294,8 +291,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" #'exwm-debug-clear) + (define-key map "\C-c\C-m" #'exwm-debug-mark))) (define-derived-mode exwm-mode nil "EXWM" "Major mode for managing X windows. diff --git a/exwm-debug.el b/exwm-debug.el index cd2ec39..4d1ca7b 100644 --- a/exwm-debug.el +++ b/exwm-debug.el @@ -1,9 +1,8 @@ ;;; 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 -;; Adrián Medraño Calvo +;; Author: Adrián Medraño Calvo ;; This file is part of GNU Emacs. @@ -29,18 +28,16 @@ (eval-and-compile (defvar exwm-debug-on nil "Non-nil to turn on debug for EXWM.")) -(defvar exwm-debug-buffer - (when exwm-debug-on - (let ((buffer (get-buffer-create "*EXWM-DEBUG*"))) - (buffer-disable-undo buffer) - buffer)) - "Buffer to write debug messages to.") +(defvar exwm-debug-buffer "*EXWM-DEBUG*" "Buffer to write debug messages to.") + +(defvar exwm-debug-backtrace-start-frame 5 + "From which frame to start collecting backtraces.") (defun exwm-debug--call-stack () "Return the current call stack frames." (let (frames frame ;; No need to acount for our setq, while, let, ... - (index 5)) + (index exwm-debug-backtrace-start-frame)) (while (setq frame (backtrace-frame index)) (push frame frames) (cl-incf index)) @@ -64,7 +61,7 @@ (defmacro exwm-debug--with-debug-buffer (&rest forms) "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) ;; Note windows whose point is at EOB. (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)))) ,@forms)) -(defun exwm-debug--clear () +(defun exwm-debug-clear () "Clear the debug buffer." (interactive) (exwm-debug--with-debug-buffer (erase-buffer))) -(defun exwm-debug--mark () +(defun exwm-debug-mark () "Insert a mark in the debug buffer." (interactive) (exwm-debug--with-debug-buffer diff --git a/exwm-input.el b/exwm-input.el index 7885d18..57fed2d 100644 --- a/exwm-input.el +++ b/exwm-input.el @@ -377,7 +377,7 @@ ARGS are additional arguments to CALLBACK." button-event window buffer frame) (xcb:unmarshal obj data) (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 (setq button-event (xcb:keysyms:keysym->event exwm--connection detail state) @@ -428,7 +428,7 @@ ARGS are additional arguments to CALLBACK." (let ((obj (make-instance 'xcb:KeyPress))) (xcb:unmarshal obj data) (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) (funcall exwm--on-KeyPress obj data) (exwm-input--on-KeyPress-char-mode obj))))