diff options
-rw-r--r-- | sx-question.el | 13 | ||||
-rw-r--r-- | sx.el | 13 |
2 files changed, 13 insertions, 13 deletions
diff --git a/sx-question.el b/sx-question.el index f5c7e86..7c2b1e9 100644 --- a/sx-question.el +++ b/sx-question.el @@ -122,6 +122,19 @@ See `sx-question--user-read-list'." (>= (or (cdr (assoc .question_id ql)) 0) .last_activity_date))))) +(defmacro sx-sorted-insert-skip-first (newelt list &optional predicate) + "Inserted NEWELT into LIST sorted by PREDICATE. +This is designed for the (site id id ...) lists. So the first car +is intentionally skipped." + `(let ((tail ,list) + (x ,newelt)) + (while (and ;; We're not at the end. + (cdr-safe tail) + ;; We're not at the right place. + (funcall (or #',predicate #'<) x (cadr tail))) + (setq tail (cdr tail))) + (setcdr tail (cons x (cdr tail))))) + (defun sx-question--mark-read (question) "Mark QUESTION as being read until it is updated again. Returns nil if question (in its current state) was already marked @@ -206,19 +206,6 @@ All ARGS are passed to `completing-read' or `ido-completing-read'." (apply (if ido-mode #'ido-completing-read #'completing-read) args)) -(defmacro sx-sorted-insert-skip-first (newelt list &optional predicate) - "Inserted NEWELT into LIST sorted by PREDICATE. -This is designed for the (site id id ...) lists. So the first car -is intentionally skipped." - `(let ((tail ,list) - (x ,newelt)) - (while (and ;; We're not at the end. - (cdr-safe tail) - ;; We're not at the right place. - (funcall (or ,predicate #'<) x (cadr tail))) - (setq tail (cdr tail))) - (setcdr tail (cons x (cdr tail))))) - (defun sx-user-error (format-string &rest args) "Like `user-error', but prepend FORMAT-STRING with \"[sx]\". See `format'." |