notmuch.el: Use let to avoid assigning to a free variable.
authorCarl Worth <cworth@cworth.org>
Tue, 1 Dec 2009 07:14:11 +0000 (23:14 -0800)
committerCarl Worth <cworth@cworth.org>
Tue, 1 Dec 2009 07:14:11 +0000 (23:14 -0800)
The dynamic scoping of emacs lisp is such that we never want to assign
to any variable unless it's something we've defined with `defvar' or
else something we're using locally via `let'.

notmuch.el

index 94a6384419ad1a46cb744e6820f603c56c1b2ef1..e605d9d24227823f7c9511bcb910747c868bb175 100644 (file)
@@ -1081,12 +1081,11 @@ Complete list of currently available key bindings:
   (if (not notmuch-tag-face-alist)
       (add-to-list 'notmuch-search-font-lock-keywords (list
                "(\\([^)]*\\))$" '(1  'notmuch-tag-face)))
-    (progn
-  (setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist))
-  (loop for notmuch-search-tag  in notmuch-search-tags
-    do (add-to-list 'notmuch-search-font-lock-keywords (list
-                               (concat "([^)]*\\(" notmuch-search-tag "\\)[^)]*)$")
-                   `(1  ,(cdr (assoc notmuch-search-tag notmuch-tag-face-alist))))))))
+    (let ((notmuch-search-tags (mapcar 'car notmuch-tag-face-alist)))
+      (loop for notmuch-search-tag  in notmuch-search-tags
+           do (add-to-list 'notmuch-search-font-lock-keywords (list
+                       (concat "([^)]*\\(" notmuch-search-tag "\\)[^)]*)$")
+                       `(1  ,(cdr (assoc notmuch-search-tag notmuch-tag-face-alist))))))))
   (set (make-local-variable 'font-lock-defaults)
          '(notmuch-search-font-lock-keywords t)))