summaryrefslogtreecommitdiff
path: root/emacs/guix-utils.el
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/guix-utils.el')
-rw-r--r--emacs/guix-utils.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el
index 98a408f875..8c1a5b42de 100644
--- a/emacs/guix-utils.el
+++ b/emacs/guix-utils.el
@@ -174,6 +174,15 @@ add both to the end and to the beginning."
(t
(concat separator str separator)))))
+(defun guix-hexify (value)
+ "Convert VALUE to string and hexify it."
+ (url-hexify-string (guix-get-string value)))
+
+(defun guix-number->bool (number)
+ "Convert NUMBER to boolean value.
+Return nil, if NUMBER is 0; return t otherwise."
+ (not (zerop number)))
+
(defun guix-shell-quote-argument (argument)
"Quote shell command ARGUMENT.
This function is similar to `shell-quote-argument', but less strict."
@@ -282,6 +291,15 @@ single argument."
(while (re-search-forward ,regexp nil t)
,@body)))
+(defmacro guix-while-null (&rest body)
+ "Evaluate BODY until its result becomes non-nil."
+ (declare (indent 0) (debug t))
+ (let ((result-var (make-symbol "result")))
+ `(let (,result-var)
+ (while (null ,result-var)
+ (setq ,result-var ,@body))
+ ,result-var)))
+
(defun guix-modify (object modifiers)
"Apply MODIFIERS to OBJECT.
OBJECT is passed as an argument to the first function from
@@ -527,6 +545,8 @@ See `defun' for the meaning of arguments."
`((,(rx "(" (group (or "guix-define-reader"
"guix-define-readers"
"guix-keyword-args-let"
+ "guix-while-null"
+ "guix-while-search"
"guix-with-indent"))
symbol-end)
. 1)