6098 comments
2357 subscribers
6259 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

On This Day...

Get the highlights as a PDF!

Stories from my Twenties: Highlights from a Decade of Blogging

Free sample!