aboutsummaryrefslogtreecommitdiff
path: root/sx.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-02-26 11:28:48 -0300
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-02-26 11:29:28 -0300
commit24090d48422233b31f9eef041814e99c47c2534d (patch)
tree360126d4797c86912c4c3127ac509e6363ada9fe /sx.el
parentca121c0c65e0e689af2ee859fdd8ebea8bc44bc5 (diff)
Manually string-trim for older emacsen. Fix #267
Diffstat (limited to 'sx.el')
-rw-r--r--sx.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/sx.el b/sx.el
index 33b36b6..ee7f0a6 100644
--- a/sx.el
+++ b/sx.el
@@ -189,6 +189,11 @@ If ALIST doesn't have a `site' property, one is created using the
;;; Utility Functions
+(defun sx--split-string (string &optional separators)
+ "Split STRING into substrings bounded by matches for SEPARATORS."
+ (mapcar (lambda (s) (replace-regexp-in-string "\\` +\\| +\\'" "" s))
+ (split-string string separators 'omit-nulls)))
+
(defun sx-completing-read (&rest args)
"Like `completing-read', but possibly use ido.
All ARGS are passed to `completing-read' or `ido-completing-read'."