[PATCH 2/3] Moved global defvar of notmuch-hello-target to function local

Tomi Ollila tomi.ollila at iki.fi
Tue Apr 24 14:11:09 PDT 2012


From: Tomi Ollila <too at iki.fi>

The global defvar notmuch-hello-target was used to silence compiler
'free variable' warning. Actually the variable (when used) was always
defined in (let...), shadowing the global in when dynamically scoped.
"Moving" the defvar in function (possibly functions in future) where it
is referenced is somewhat cleaner solution.

---
 emacs/notmuch-hello.el |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 8ae0aca..c2cda19 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -235,14 +235,6 @@ supported for \"Customized queries section\" items."
 	    notmuch-hello-query-section
 	    (function :tag "Custom section"))))
 
-(defvar notmuch-hello-target nil
-  "Button text at position of point before rebuilding the notmuch-buffer.
-
-This variable contains the text of the button, if any, the
-point was positioned at before the notmuch-hello buffer was
-rebuilt. This should never actually be global and is defined as a
-defvar only for documentation purposes and to avoid a compiler
-warning about it occurring as a free variable.")
 
 (defvar notmuch-hello-hidden-sections nil
   "List of sections titles whose contents are hidden")
@@ -421,6 +413,7 @@ SEARCHES must be a list containing lists of the form (NAME QUERY COUNT), where
 QUERY is the query to start when the button for the corresponding entry is
 activated. COUNT should be the number of messages matching the query.
 Such a list can be computed with `notmuch-hello-query-counts'."
+  (defvar notmuch-hello-target) ;; dynamically bound in call path (or nil)
   (let* ((widest (notmuch-hello-longest-label searches))
 	 (tags-and-width (notmuch-hello-tags-per-line widest))
 	 (tags-per-line (car tags-and-width))
-- 
1.7.7.6



More information about the notmuch mailing list