Get rid of the compile-time `cl' requirement for this particular function.

---
 emacs/notmuch.el |   40 ++++++++++++++++++++++------------------
 1 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index ef4dcc7..2426c0a 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -1084,24 +1084,28 @@ current search results AND that are tagged with the 
given tag."
 If the current buffer is the only notmuch buffer, bury it. If no
 notmuch buffers exist, run `notmuch'."
   (interactive)
-
-  (let (start first)
-    ;; If the current buffer is a notmuch buffer, remember it and then
-    ;; bury it.
-    (when (notmuch-interesting-buffer (current-buffer))
-      (setq start (current-buffer))
-      (bury-buffer))
-
-    ;; Find the first notmuch buffer.
-    (setq first (loop for buffer in (buffer-list)
-                    if (notmuch-interesting-buffer buffer)
-                    return buffer))
-
-    (if first
-       ;; If the first one we found is any other than the starting
-       ;; buffer, switch to it.
-       (unless (eq first start)
-         (switch-to-buffer first))
+  (let* ((old-buffer (current-buffer))
+        (next-buffer (first
+         ;; Find interesting buffers:
+         ;; Loop over all existing buffers and return those that
+         ;; satisfy the predicate (`notmuch-interesting-buffer' and
+         ;; not `eq' to current buffer) integrally;  All others are
+         ;; replaced with `nil'.  Then strip out all `nil's using
+         ;; `delq'.  Basically a re-implementation of `cl' package's
+         ;; `delete-if-not'.
+         (delq nil
+          (mapcar (lambda (b)
+                    (and (notmuch-interesting-buffer b)
+                         (not (eq old-buffer b))
+                         b))
+                  (buffer-list))))))
+
+    ;; If there's a next buffer, switch to it and bury the
+    ;; original current buffer.  Otherwise run `notmuch-hello'.
+    (if next-buffer
+       (progn
+         (switch-to-buffer next-buffer)
+         (bury-buffer old-buffer))
       (notmuch))))

 (setq mail-user-agent 'notmuch-user-agent)
-- 
1.7.8.1

Reply via email to