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

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

[nongnu] elpa/pacmacs 1e1cebe39a 073/472: Introduce plist-map utility fu


From: ELPA Syncer
Subject: [nongnu] elpa/pacmacs 1e1cebe39a 073/472: Introduce plist-map utility function (#54)
Date: Thu, 6 Jan 2022 21:59:14 -0500 (EST)

branch: elpa/pacmacs
commit 1e1cebe39a35a7d80a22dfc505577433038c3981
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>

    Introduce plist-map utility function (#54)
---
 pacman-anim.el  | 5 +----
 pacman-utils.el | 8 ++++++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/pacman-anim.el b/pacman-anim.el
index 2e49f35123..de2f09a726 100644
--- a/pacman-anim.el
+++ b/pacman-anim.el
@@ -85,10 +85,7 @@
       (plist-put anim :current-frame new-current-frame))))
 
 (defun pacman-anim-object-next-frame (anim-object)
-  (plist-bind ((anim :animation))
-      anim-object
-    (plist-put anim-object :animation
-               (pacman-anim-next-frame anim))))
+  (plist-map anim-object :animation #'pacman-anim-next-frame))
 
 (provide 'pacman-anim)
 
diff --git a/pacman-utils.el b/pacman-utils.el
index db0bbe5a83..3ff2903462 100644
--- a/pacman-utils.el
+++ b/pacman-utils.el
@@ -42,6 +42,14 @@
                       keys))
        ,@body)))
 
+(defun plist-map (plist property transformer)
+  "Transform the value of PROPERTY in PLIST with TRANSFORMER.
+This function modifies plist with plist-put. So it does the same
+side-effects."
+  (plist-bind ((value property)) plist
+    (plist-put plist property
+               (funcall transformer value))))
+
 (provide 'pacman-utils)
 
 ;;; pacman.el ends here



reply via email to

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