diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-14 16:43:42 -0200 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-14 16:43:42 -0200 |
commit | 1845ab03a3083088b621108040fc1aa89a6d7f85 (patch) | |
tree | c1ed6bf1270e3657cd031da029b95f6ed1d9c4fb /sx-question-print.el | |
parent | 461a0b63529f0185f1bbe86cb07e7f6cd88d2ef7 (diff) | |
parent | 7d6583a6da023f0a1f243d01cb2d856e272fc625 (diff) |
Merge remote-tracking branch 'refs/remotes/origin/master' into improve-comments
Diffstat (limited to 'sx-question-print.el')
-rw-r--r-- | sx-question-print.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sx-question-print.el b/sx-question-print.el index 7881b52..9a51efb 100644 --- a/sx-question-print.el +++ b/sx-question-print.el @@ -166,7 +166,12 @@ QUESTION must be a data structure returned by `json-read'." ;; Print everything (sx-question-mode--print-section question) (sx-assoc-let question - (mapc #'sx-question-mode--print-section .answers)) + (mapc #'sx-question-mode--print-section + (cl-sort .answers + ;; Highest-voted first. @TODO: custom sorting + (lambda (a b) + (> (cdr (assoc 'score a)) + (cdr (assoc 'score b))))))) (insert "\n\n ") (insert-text-button "Write an Answer" :type 'sx-button-answer) ;; Go up @@ -315,10 +320,10 @@ E.g.: (rx (or (and "[" (group-n 1 (1+ (not (any "]")))) "]" (or (and "(" (group-n 2 (1+ (not (any ")")))) ")") (and "[" (group-n 3 (1+ (not (any "]")))) "]"))) - (group-n 4 (and (or (and "http" (opt "s") "://") "") - (+ (any alnum "_%")) + (group-n 4 (and (and "http" (opt "s") "://") "" + (>= 2 (any lower numeric "_%")) "." - (+ (any alnum "/._%&#?=;")))))) + (>= 2 (any lower numeric "/._%&#?=;")))))) "Regexp matching markdown links.") (defun sx-question-mode--fill-and-fontify (text) |