Replace (setf (alist-get ...)) with the faster (setcdr (assq ...))

This commit is contained in:
Gerard Vermeulen 2023-02-26 18:47:24 +01:00
parent 9e4b79f0fd
commit 888466e7d1

View File

@ -5022,8 +5022,8 @@ Available versions: 0.2.0, 0.1.1, 0.1.0
(json-parse-buffer :array-type 'list :object-type 'alist)) (json-parse-buffer :array-type 'list :object-type 'alist))
(let ((alists pip-outdated-packages)) (let ((alists pip-outdated-packages))
(while alists (while alists
(setf (alist-get 'name (car alists)) (setcdr (assq 'name (car alists))
(string-replace "_" "-" (alist-get 'name (car alists)))) (string-replace "_" "-" (alist-get 'name (car alists))))
(setq alists (cdr alists)))) (setq alists (cdr alists))))
(kill-buffer) (kill-buffer)
(message "Calling `%S' succeeded" #'pip-list-outdated)))) (message "Calling `%S' succeeded" #'pip-list-outdated))))
@ -5147,7 +5147,7 @@ buffer to check whether upgrading has made the dependencies incompatible."
(cl-pushnew rv (alist-get 'required_version old) :test #'equal)) (cl-pushnew rv (alist-get 'required_version old) :test #'equal))
(let* ((new (assq-delete-all 'dependencies (copy-alist parent))) (let* ((new (assq-delete-all 'dependencies (copy-alist parent)))
(rvs (split-string (alist-get 'required_version new) "[,]+"))) (rvs (split-string (alist-get 'required_version new) "[,]+")))
(setf (alist-get 'required_version new) rvs) (setcdr (assq 'required_version new) rvs)
(push new found)))) (push new found))))
found) found)