summaryrefslogtreecommitdiff
path: root/src/wasp-utils.el
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2024-11-26 03:23:31 -0500
committerLLLL Colonq <llll@colonq>2024-11-26 03:23:31 -0500
commit0b95071fe628d91238549b062961e724088d3b8b (patch)
treeb4cf3ae960e0b52ed014ab4ba423fda1075e5d60 /src/wasp-utils.el
parent6e3c47b1ad746f0891592a97cc6ffb6e0280adbb (diff)
Update :4
Diffstat (limited to 'src/wasp-utils.el')
-rw-r--r--src/wasp-utils.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/wasp-utils.el b/src/wasp-utils.el
index c0f4ec54..78751646 100644
--- a/src/wasp-utils.el
+++ b/src/wasp-utils.el
@@ -40,6 +40,10 @@ Return nil on error."
(w/write-line (format "%s" line) face)
(goto-char (point-max))))
+(defun w/append-file (s path)
+ "Append S to the file at PATH."
+ (f--write-bytes (encode-coding-string s 'utf-8) path t))
+
(defmacro w/defstruct (name &rest body)
"Define a structure with NAME (with the constructor under the w/ namespace).
BODY is passed directly to `cl-defstruct'."
@@ -54,7 +58,7 @@ BODY is passed directly to `cl-defstruct'."
(defun w/pick-random (xs)
"Pick a random element of XS."
- (nth (random (length xs)) xs))
+ (and xs (nth (random (length xs)) xs)))
(defun w/shuffle (s)
"Shuffle S."