[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/xelb b8f168b: Simplify debugging and fix dynamic-scopin
From: |
Chris Feng |
Subject: |
[elpa] externals/xelb b8f168b: Simplify debugging and fix dynamic-scoping `eval' |
Date: |
Sun, 16 Sep 2018 10:01:50 -0400 (EDT) |
branch: externals/xelb
commit b8f168b401977098fe2b30f4ca32629c0ab6eb83
Author: Stefan Monnier <address@hidden>
Commit: Chris Feng <address@hidden>
Simplify debugging and fix dynamic-scoping `eval'
* xcb-types.el (xcb:debug): New global minor mode to replace
`xcb:debug-on' and `xcb:debug-toggle'.
(xcb:-log): Use it.
* xcb-types.el (xcb:deftypealias): Use lexical-scoping `eval'.
---
xcb-types.el | 20 +++++++-------------
xcb.el | 4 ----
2 files changed, 7 insertions(+), 17 deletions(-)
diff --git a/xcb-types.el b/xcb-types.el
index d368f34..f8ee0b9 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -53,17 +53,9 @@
(require 'eieio)
(require 'xcb-debug)
-(defvar xcb:debug-on nil "Non-nil to turn on debug.")
-
-(defun xcb:debug-toggle (&optional arg)
- "Toggle XELB 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 xcb:debug-on (if (eq arg 'toggle)
- (not xcb:debug-on)
- (> 0 arg))))
+(define-minor-mode xcb:debug
+ "Debug-logging enabled if non-nil"
+ :global t)
(defmacro xcb:-log (&optional format-string &rest objects)
"Emit a message prepending the name of the function being executed.
@@ -71,7 +63,7 @@ ARG is nil, toggle debugging output."
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 xcb:debug-on
+ `(when xcb:debug
(xcb-debug:message ,(concat "%s:\t" format-string "\n")
(xcb-debug:compile-time-function-name)
,@objects)
@@ -421,7 +413,9 @@ FORMAT-STRING is a string specifying the message to output,
as in
(defmacro xcb:deftypealias (new-type old-type)
"Define NEW-TYPE as an alias of type OLD-TYPE."
`(progn
- (cl-deftype ,(eval new-type) nil ,old-type)
+ ;; FIXME: `new-type' should probably just not be eval'd at all,
+ ;; but that requires changing all callers not to quote their arg.
+ (cl-deftype ,(eval new-type t) nil ,old-type)
(defvaralias ,new-type ,old-type)))
;; 1/2/4 B signed/unsigned integer
diff --git a/xcb.el b/xcb.el
index ebb3702..7ed2d3e 100644
--- a/xcb.el
+++ b/xcb.el
@@ -44,10 +44,6 @@
;; - `xcb:generate-id'
;; Please refer to their documentations for more details.
-;; If you ever encountered errors when using this library, please set
-;; `xcb:debug-on' to `t' before loading it; this should provide you more clues
-;; on what is going wrong.
-
;; Todo:
;; + Use XC-MISC extension for `xcb:generate-id' when IDs are used up.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/xelb b8f168b: Simplify debugging and fix dynamic-scoping `eval',
Chris Feng <=