[Top][All Lists]

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

[elpa] master 80c2669 142/184: ivy.el (ivy--alist-set): Work-around emac

From: Oleh Krehel
Subject: [elpa] master 80c2669 142/184: ivy.el (ivy--alist-set): Work-around emacs-24.3 not having alist-get
Date: Wed, 16 Oct 2019 13:15:10 -0400 (EDT)

branch: master
commit 80c266983422f777416e1639ebe9b5dbb37a3603
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy.el (ivy--alist-set): Work-around emacs-24.3 not having alist-get
 ivy.el | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/ivy.el b/ivy.el
index bf5bdaf..cc93077 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1908,6 +1908,13 @@ May supersede `ivy-initial-inputs-alist'."
 (defvar ivy-unwind-fns-alist nil
   "An alist associating commands to their :unwind values.")
+(defun ivy--alist-set (alist-sym key val)
+  (let ((cell (assoc key (symbol-value alist-sym))))
+    (if cell
+        (setcdr cell val)
+      (set alist-sym (cons (cons key val)
+                           (symbol-value alist-sym))))))
 (cl-defun ivy-configure (caller
@@ -1918,15 +1925,15 @@ May supersede `ivy-initial-inputs-alist'."
   "Configure `ivy-read' params for CALLER."
   (declare (indent 1))
   (when initial-input
-    (setf (alist-get caller ivy-initial-inputs-alist) initial-input))
+    (ivy--alist-set 'ivy-initial-inputs-alist caller initial-input))
   (when occur
     (ivy-set-occur caller occur))
   (when update-fn
-    (setf (alist-get caller ivy-update-fns-alist) update-fn))
+    (ivy--alist-set 'ivy-update-fns-alist caller update-fn))
   (when unwind-fn
-    (setf (alist-get caller ivy-unwind-fns-alist) unwind-fn))
+    (ivy--alist-set 'ivy-unwind-fns-alist caller unwind-fn))
   (when more-chars
-    (setf (alist-get caller ivy-more-chars-alist) more-chars)))
+    (ivy--alist-set 'ivy-more-chars-alist caller more-chars)))
 (defcustom ivy-sort-max-size 30000
   "Sorting won't be done for collections larger than this."

reply via email to

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