5065 comments
2219 subscribers
4799 on Twitter
Subscribe! Feed reader E-mail

Modification of johnsu01′s scoring

The following code allows you to sort tasks based on regexp matches
against the line. It’s fairly simple, but may give people ideas about
fancier task sorting.

(setq planner-sort-tasks-key-function 'planner-sort-tasks-by-score)

(defvar planner-score-rules '(("read" . 50))
  "Alist of planner scoring rules of the form (regexp . score-value).
Tasks with higher scores are listed first.")

(defun planner-sort-tasks-by-score ()
  "Sort tasks by the rule in the table."
  (let ((score 0)
        (case-fold-search t)
        (line (buffer-substring-no-properties (line-beginning-position)
                                              (line-end-position))))
    (mapc
     (lambda (item)
       (when (string-match (car item) line)
         (setq score (- score (cdr item)))))
     planner-score-rules)
    score))

On Technorati: ,

Short URL: http://sachachua.com/blog/p/2630

Comment, share a thought, ask a question...

Please comment as you, not your organization.





 

On This Day...