[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/wcheck-mode f92887e 08/39: Eval wcheck--buffer-data-key

From: Teemu Likonen
Subject: [elpa] externals/wcheck-mode f92887e 08/39: Eval wcheck--buffer-data-key-index only once in wcheck--buffer-data-get
Date: Sun, 4 Oct 2020 07:55:18 -0400 (EDT)

branch: externals/wcheck-mode
commit f92887e2699894c1a77cc7ba35c07e22c0230da3
Author: Teemu Likonen <tlikonen@iki.fi>
Commit: Teemu Likonen <tlikonen@iki.fi>

    Eval wcheck--buffer-data-key-index only once in wcheck--buffer-data-get
 wcheck-mode.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/wcheck-mode.el b/wcheck-mode.el
index 427165b..70dcea6 100644
--- a/wcheck-mode.el
+++ b/wcheck-mode.el
@@ -2179,12 +2179,13 @@ But only if it doesn't exist already."
 If optional TARGET-KEY is not given return all data associated
 with the matching KEY VALUE."
   (catch 'answer
-    (dolist (item wcheck--buffer-data)
-      (when (equal value (aref item (wcheck--buffer-data-key-index key)))
-        (throw 'answer (if target-key
-                           (aref item (wcheck--buffer-data-key-index
-                                       target-key))
-                         item))))))
+    (let ((index (wcheck--buffer-data-key-index key)))
+      (dolist (item wcheck--buffer-data)
+        (when (equal value (aref item index))
+          (throw 'answer (if target-key
+                             (aref item (wcheck--buffer-data-key-index
+                                         target-key))
+                           item)))))))
 (defun wcheck--buffer-data-get-all (&optional key)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]