aboutsummaryrefslogtreecommitdiff
path: root/sx.el
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2014-11-11 12:12:30 -0500
committerSean Allred <code@seanallred.com>2014-11-11 12:12:30 -0500
commitf6699988fd521703c1d44489e3d89c6f71d418df (patch)
treefb47c358eb81ac72a98b176779155d25d080a2e9 /sx.el
parent6167df68eba9e8f69f285d47454afdce3ac94168 (diff)
Move question sorting function to sx.el
It is not specific to questions -- it is generally applicable to any alist.
Diffstat (limited to 'sx.el')
-rw-r--r--sx.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/sx.el b/sx.el
index 6165714..0a1b046 100644
--- a/sx.el
+++ b/sx.el
@@ -160,6 +160,13 @@ Run after `sx-init--internal-hook'.")
This is used internally to set initial values for variables such
as filters.")
+(defun sx--< (property x y &optional pred)
+ "Non-nil if PROPERTY attribute of question X is less than that of Y.
+With optional argument predicate, use it instead of `<'."
+ (funcall (or pred #'<)
+ (cdr (assoc property x))
+ (cdr (assoc property y))))
+
(defmacro sx-init-variable (variable value &optional setter)
"Set VARIABLE to VALUE using SETTER.
SETTER should be a function of two arguments. If SETTER is nil,