emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emacs-wiki-discuss] XEmacs/make-extent stacktrace and planner-sort-task


From: Angus Lees
Subject: [emacs-wiki-discuss] XEmacs/make-extent stacktrace and planner-sort-tasks loops
Date: Tue, 26 Apr 2005 16:53:23 +1000
User-agent: Wanderlust/2.10.1 (Watching The Wheels) XEmacs/21.4 (Jumbo Shrimp)

I'm still getting the occasional unkillable loop in planner-sort-tasks
- even with my earlier patch to restore point (and I'm pretty sure
this is the same as the "stacktrace on XEmacs starting with
make-extent" report sometime earlier)

Looking for some docs on sort-subr-1, I was a bit disturbed to find it
wasn't actually documented and therefore (presumably) not intented for
public use.  I've written a version which uses what I think is the
main sort entry point `sort-subr' (below).  I've used it for a few
days now and it seems to do the right thing (and avoid the looping
problem).


(defun planner-sort-tasks ()
  "Sort the tasks.
On day pages, sort according to priority and position.  On plan
pages, sort according to status, priority, date, and position."
  (interactive)
  (let ((case-fold-search nil)
        (font-lock-fontify-buffer-function nil)
        (font-lock-fontify-region-function nil)
        (font-lock-unfontify-buffer-function nil)
        (font-lock-unfontify-region-function nil)
        (planner-on-date-page (string-match planner-date-regexp
                                            (planner-page-name))))
    (save-excursion
      (goto-char (point-min))
      (while (re-search-forward "^#[A-C][0-9]*" nil t)
        (goto-char (match-beginning 0))
        (let ((here (point)))
          (while (and (char-after) (= (char-after) ?#))
            (forward-line 1))
          (save-restriction
            (narrow-to-region here (point))
            (goto-char here)
            (sort-subr nil
                       'forward-line 'end-of-line
                       planner-sort-tasks-key-function nil
                       nil)
            (goto-char (point-max)))))))
  nil)                       ; Must return nil because of write-file-functions


-- 
 - Gus




reply via email to

[Prev in Thread] Current Thread [Next in Thread]