From 3328a62d42ff3ca62c31366a4cd0cfd38a3ec663 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Thu, 15 Jan 2015 00:01:32 -0500 Subject: Create and implement comparator creation macro This obsoletes `sx--<'. --- sx-question-list.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sx-question-list.el') diff --git a/sx-question-list.el b/sx-question-list.el index 1b7fe5a..5909156 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -322,11 +322,11 @@ into consideration. ;; Add a setter to protect the value. :group 'sx-question-list) -(defun sx-question-list--date-more-recent-p (x y) - "Non-nil if tabulated-entry X is newer than Y." - (sx--< - sx-question-list-date-sort-method - (car x) (car y) #'>)) +(sx--create-comparator sx-question-list--date-more-recent-p + "Non-nil if tabulated-entry A is newer than B." + > (lambda (x) + (cdr (assoc sx-question-list-date-sort-method + (car x))))) ;;; Keybinds -- cgit v1.2.3 From 9b093f7a7a02e31dc6985619f5277ee945f6f90d Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Thu, 15 Jan 2015 00:22:04 -0500 Subject: Small bugfix Everything must now be a proper function. --- sx-question-list.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sx-question-list.el') diff --git a/sx-question-list.el b/sx-question-list.el index 5909156..cb5bc33 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -324,9 +324,9 @@ into consideration. (sx--create-comparator sx-question-list--date-more-recent-p "Non-nil if tabulated-entry A is newer than B." - > (lambda (x) - (cdr (assoc sx-question-list-date-sort-method - (car x))))) + #'> (lambda (x) + (cdr (assoc sx-question-list-date-sort-method + (car x))))) ;;; Keybinds -- cgit v1.2.3 From b9eab6419e514fc6e1ce3096892bccd8a8ffb121 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Fri, 16 Jan 2015 00:40:26 -0500 Subject: Use assq instead of assoc --- sx-question-list.el | 3 +-- sx-question.el | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'sx-question-list.el') diff --git a/sx-question-list.el b/sx-question-list.el index cb5bc33..41bebda 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -325,8 +325,7 @@ into consideration. (sx--create-comparator sx-question-list--date-more-recent-p "Non-nil if tabulated-entry A is newer than B." #'> (lambda (x) - (cdr (assoc sx-question-list-date-sort-method - (car x))))) + (cdr (assq sx-question-list-date-sort-method (car x))))) ;;; Keybinds diff --git a/sx-question.el b/sx-question.el index 7c687e8..e199966 100644 --- a/sx-question.el +++ b/sx-question.el @@ -192,15 +192,15 @@ If no cache exists for it, initialize one with SITE." (sx--create-comparator sx-answer-higher-score-p "Return t if answer A has a higher score than answer B." - #'> (lambda (x) (cdr (assoc 'score x)))) + #'> (lambda (x) (cdr (assq 'score x)))) (sx--create-comparator sx-answer-older-p "Return t if answer A was posted later than answer B." - #'< (lambda (x) (cdr (assoc 'creation_date x)))) + #'< (lambda (x) (cdr (assq 'creation_date x)))) (sx--create-comparator sx-answer-more-active-p "Return t if answer A was updated after answer B." - #'> (lambda (x) (cdr (assoc 'last_activity_date x)))) + #'> (lambda (x) (cdr (assq 'last_activity_date x)))) (provide 'sx-question) ;;; sx-question.el ends here -- cgit v1.2.3