about summary refs log tree commit diff
path: root/users/glittershark/emacs.d/utils.el
diff options
context:
space:
mode:
Diffstat (limited to 'users/glittershark/emacs.d/utils.el')
-rw-r--r--users/glittershark/emacs.d/utils.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/users/glittershark/emacs.d/utils.el b/users/glittershark/emacs.d/utils.el
index d6d1d5722b5f..c595b46ce258 100644
--- a/users/glittershark/emacs.d/utils.el
+++ b/users/glittershark/emacs.d/utils.el
@@ -90,3 +90,16 @@ Returns nil if the regex did not match, non-nil otherwise"
         ,@body
         (evil-indent beg (+ (line-end-position) 1))))
      (goto-line-char orig-line-char)))
+
+(pcase-defmacro s-starts-with (prefix)
+  `(pred (s-starts-with-p ,prefix)))
+
+(pcase-defmacro s-contains (needle &optional ignore-case)
+  `(pred (s-contains-p ,needle
+                       ,@(when ignore-case (list ignore-case)))))
+
+(comment
+ (pcase "foo"
+   ((s-contains "bar") 1)
+   ((s-contains "o") 2))
+ )