branch: elpa/undo-fu-session
commit 9147a7223ee8136769cf42239c7d9a8577edfaff
Author: Campbell Barton <[email protected]>
Commit: Campbell Barton <[email protected]>

    Cleanup: avoid using throw/catch for filename matcher
---
 undo-fu-session.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/undo-fu-session.el b/undo-fu-session.el
index a06eccee6c..87c954020a 100755
--- a/undo-fu-session.el
+++ b/undo-fu-session.el
@@ -489,15 +489,19 @@ Argument PENDING-LIST an `pending-undo-list' compatible 
list."
 (defun undo-fu-session--match-file-name (filename test-files)
   "Return t if FILENAME match any item in TEST-FILES."
   ;; NOTE: can't be `side-effect-free' because it calls a user defined 
callback.
-  (catch 'found
-    (let ((case-fold-search (file-name-case-insensitive-p filename)))
-      (dolist (matcher test-files)
+  (let ((case-fold-search (file-name-case-insensitive-p filename))
+        (found nil))
+    (while test-files
+      (let ((matcher (pop test-files)))
         (when (cond
                ((stringp matcher)
                 (string-match-p matcher filename))
                (t
                 (funcall matcher filename)))
-          (throw 'found t))))))
+          ;; Break.
+          (setq test-files nil)
+          (setq found t))))
+    found))
 
 (defun undo-fu-session--match-major-mode (mode test-modes)
   "Return t if MODE match any item in TEST-MODES."

Reply via email to