emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/compat a0ea4ae 65/99: Call alist-get-full-elisp from al


From: ELPA Syncer
Subject: [elpa] externals/compat a0ea4ae 65/99: Call alist-get-full-elisp from alist-get-handle-testfn
Date: Sun, 17 Oct 2021 05:57:58 -0400 (EDT)

branch: externals/compat
commit a0ea4ae37f66f4680a4c3eec65b5a4b49af69961
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Call alist-get-full-elisp from alist-get-handle-testfn
    
    This reduces code duplication and makes use of the speed improvements
    in compat--alist-get-handle-testfn.
---
 compat-26.1.el | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/compat-26.1.el b/compat-26.1.el
index 9415652..b7111fa 100644
--- a/compat-26.1.el
+++ b/compat-26.1.el
@@ -75,6 +75,8 @@ from the absolute start of the buffer, disregarding the 
narrowing."
 
 ;;;; Defined in subr.el
 
+(declare-function compat--alist-get-full-elisp "compat-25.1"
+                  (key alist &optional default remove testfn))
 (compat-advise alist-get (key alist &optional default remove testfn)
   "Handle TESTFN manually."
   :min-version "25.1"                  ;first defined in 25.1
@@ -82,12 +84,8 @@ from the absolute start of the buffer, disregarding the 
narrowing."
   :realname compat--alist-get-handle-testfn
   :cond (compat-maxargs-/= #'alist-get 5)
   (if testfn
-      (catch 'found
-        (dolist (ent alist)
-          (when (and (consp ent) (funcall testfn (car ent) key))
-            (throw 'found (cdr ent))))
-        default)
-    (funcall oldfun key alist default remove testfn)))
+      (compat--alist-get-full-elisp key alist default remove testfn)
+    (funcall oldfun key alist default remove)))
 
 (compat-defun string-trim-left (string &optional regexp)
   "Trim STRING of leading string matching REGEXP.



reply via email to

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