diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-02-26 22:19:05 -0300 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-02-26 22:19:05 -0300 |
commit | 7df79a35edcb79e7caca4a0d50fcec54d5f68fef (patch) | |
tree | cc2bcb61f4350dce6a5b5ecba12218f25645275f /sx.el | |
parent | 83538b215f75256b86987b999504a2d87d0db307 (diff) | |
parent | f4ba0e2a11581477e412c276080a049d19351361 (diff) |
Merge branch 'master' into question-mode-line
Diffstat (limited to 'sx.el')
-rw-r--r-- | sx.el | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -195,6 +195,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'." @@ -341,6 +346,12 @@ GET-FUNC and performs the actual comparison." "Return STRING with consecutive whitespace squashed together." (replace-regexp-in-string "[ \r\n]+" " " string)) +(defun sx--invert-predicate (predicate) + "Return PREDICATE function with arguments inverted. +For instance (sx--invert-predicate #'<) is the same as #'>. +Note this is not the same as negating PREDICATE." + (lambda (&rest args) (apply predicate (reverse args)))) + ;;; Printing request data (defvar sx--overlays nil |