summary history branches tags files
commit:d7b78fa184c4d41df563ef01755b175edb9f59ce
author:Trevor Bentley
committer:Trevor Bentley
date:Tue Dec 8 00:44:38 2020 +0100
parents:88b24e7f456b19696bf2635839a5d45485266b96
fix more warnings when byte compiling
diff --git a/release.sh b/release.sh
line changes: +1/-0
index 8d25a6c..0a9f5aa
--- a/release.sh
+++ b/release.sh
@@ -12,6 +12,7 @@ fi
 mkdir "$PKG"
 sh gen_readme.sh
 cp snitch*.el "$PKG"
+rm "$PKG/snitch-test.el"
 cp README.md "$PKG"
 tar -cf "$PKG.tar" "$PKG"
 

diff --git a/snitch-backtrace.el b/snitch-backtrace.el
line changes: +12/-7
index 8b1ad50..53f77ca
--- a/snitch-backtrace.el
+++ b/snitch-backtrace.el
@@ -36,6 +36,11 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;;; Code:
+(require 'cl-macs) ; cl loops
+(require 'package) ; backtrace package sources
+(require 'backtrace)
+
+(require 'snitch-timer)
 
 ;; Since the backtrace functions might be called extremely often,
 ;; particularly when timer tracing is enabled, much of the metadata
@@ -197,9 +202,9 @@ backtrace if this one originated from a timer callback.
 ‘snitch-trace-timers’ must be t for this to have any effect.  If
 it is enabled, and a matching timer is found, the backtraces are
 concatenated together."
-  (setq stack '())
-  (setq timer-args 'nil)
-  (let* ((frames (backtrace-get-frames))
+  (let* ((stack '())
+         (timer-args nil)
+         (frames (backtrace-get-frames))
          ;; 5 is the magic number of frames to skip out of the
          ;; snitch-related calls (0 indexed, so idx > 4):
          ;;
@@ -247,10 +252,10 @@ concatenated together."
             (if (eq fun #'timer-event-handler)
                 (setq timer-args (car (backtrace-frame-args frame))))
             ;;(message "frame %d: %s (%s) [%s]" idx fun path package)
-            (push (list clean-fun path package) stack)))))
-  (if follow-timer
-      (snitch--maybe-add-timer-backtrace stack timer-args)
-    (nreverse stack)))
+            (push (list clean-fun path package) stack))))
+    (if follow-timer
+        (snitch--maybe-add-timer-backtrace stack timer-args)
+      (nreverse stack))))
 
 (defun snitch--package-type-more-important (a b)
   "Return t if package type of 'a' is more important than the

diff --git a/snitch-log.el b/snitch-log.el
line changes: +4/-4
index 173ce96..f23155c
--- a/snitch-log.el
+++ b/snitch-log.el
@@ -98,13 +98,13 @@ can be used to deserialize back into an object with eval."
   ;; standard output stream to a function that consumes the output
   ;; char by char.  This must be reversed and concatenated to
   ;; produce the final string.
-  (setq pretty-obj nil)
-  (let ((old-std standard-output))
+  (let ((pretty-obj nil)
+        (old-std standard-output))
     (setq standard-output (lambda (c) (setq pretty-obj (cons c pretty-obj))))
     (object-write event)
     (setq pretty-obj (concat (nreverse pretty-obj)))
-    (setq standard-output old-std))
-  pretty-obj)
+    (setq standard-output old-std)
+    pretty-obj))
 
 (defun snitch--propertize (logmsg event)
   "Add text properties to LOGMSG with elements from EVENT.  This

diff --git a/snitch-timer.el b/snitch-timer.el
line changes: +19/-19
index ad2517d..4c07cf7
--- a/snitch-timer.el
+++ b/snitch-timer.el
@@ -210,25 +210,25 @@ any that have timed out."
 (defun snitch--remove-timers (timers)
   "Remove all timers in TIMERS from the timer backtrace cache, if
 present."
-  (setq total-timers (length timers))
-  (setq removed-timers 0)
-  (cl-loop
-   for timer in timers
-   do (let ((match (assq timer snitch--timer-alist)))
-        (when (and (null match)
-                   snitch-print-timer-warnings)
-          (message "*snitch warning* remove unknown timer: %s"
-                   (snitch--fn-repr (timer--function timer)))
-          (setq snitch--timer-missed-count
-                (+ snitch--timer-missed-count 1)))
-        (when match
-          (setq snitch--timer-removed-count
-                (+ snitch--timer-removed-count 1))
-          (setq removed-timers (1+ removed-timers))
-          (setq snitch--timer-alist
-                (delq match snitch--timer-alist)))))
-  ;;(message "removed %d of %d timers" removed-timers total-timers)
-  (list removed-timers total-timers))
+  (let ((total-timers (length timers))
+        (removed-timers 0))
+    (cl-loop
+     for timer in timers
+     do (let ((match (assq timer snitch--timer-alist)))
+          (when (and (null match)
+                     snitch-print-timer-warnings)
+            (message "*snitch warning* remove unknown timer: %s"
+                     (snitch--fn-repr (timer--function timer)))
+            (setq snitch--timer-missed-count
+                  (+ snitch--timer-missed-count 1)))
+          (when match
+            (setq snitch--timer-removed-count
+                  (+ snitch--timer-removed-count 1))
+            (setq removed-timers (1+ removed-timers))
+            (setq snitch--timer-alist
+                  (delq match snitch--timer-alist)))))
+    ;;(message "removed %d of %d timers" removed-timers total-timers)
+    (list removed-timers total-timers)))
 
 (defun snitch--remove-timer-backtrace (orig-fn timer)
   "Remove a timer from snitch’s cache.  This function is wrapped