summary refs log tree commit diff
path: root/emacs/guix-utils.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-11-04 21:40:31 +0300
committerAlex Kost <alezost@gmail.com>2015-11-12 21:22:35 +0300
commit959c78f69a498b1cc558d6c8e6bc3faa78dd5423 (patch)
tree98e1bbb5e6d2f82e75a16ef4677a186ed32744b0 /emacs/guix-utils.el
parent4f8f15cd5ca6da045ac811552f503b32aced8935 (diff)
downloadguix-959c78f69a498b1cc558d6c8e6bc3faa78dd5423.tar.gz
emacs: Improve post processing of popup arguments.
* emacs/guix-command.el (guix-command-switches,
  guix-command-rest-arg-regexp): New variables.
  (guix-command-post-processors,
  guix-command-post-process-matching-args,
  guix-command-post-process-rest-single,
  guix-command-post-process-rest-multiple,
  guix-command-post-process-rest-multiple-leave,
  guix-command-post-process-package-args): New functions.
  (guix-command-post-process-rest-multiple): Take 2 arguments.
  (guix-command-define-popup-action): Adjust accordingly.
* emacs/guix-utils.el (guix-modify): New function.
Diffstat (limited to 'emacs/guix-utils.el')
-rw-r--r--emacs/guix-utils.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el
index d1f088b6a8..5f3f3ecc10 100644
--- a/emacs/guix-utils.el
+++ b/emacs/guix-utils.el
@@ -226,6 +226,17 @@ single argument."
      (while (re-search-forward ,regexp nil t)
        ,@body)))
 
+(defun guix-modify (object modifiers)
+  "Apply MODIFIERS to OBJECT.
+OBJECT is passed as an argument to the first function from
+MODIFIERS list, the returned result is passed to the second
+function from the list and so on.  Return result of the last
+modifier call."
+  (if (null modifiers)
+      object
+    (guix-modify (funcall (car modifiers) object)
+                 (cdr modifiers))))
+
 
 ;;; Alist accessors