Function: todo-backward-item
todo-backward-item is a byte-compiled function defined in
todo-mode.el.gz.
Signature
(todo-backward-item &optional COUNT)
Documentation
Move point up to start of item with next higher priority.
With positive numerical prefix COUNT, move point COUNT items upward.
If the category's done items are visible, this command called with a prefix argument only moves point to a higher item, e.g., with point on the first done item and called with prefix 1, it moves to the last todo item; but if called with point on the first done item without a prefix argument, it moves point to the empty line above the done items separator.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/todo-mode.el.gz
(defun todo-backward-item (&optional count)
"Move point up to start of item with next higher priority.
With positive numerical prefix COUNT, move point COUNT items
upward.
If the category's done items are visible, this command called
with a prefix argument only moves point to a higher item, e.g.,
with point on the first done item and called with prefix 1, it
moves to the last todo item; but if called with point on the
first done item without a prefix argument, it moves point to the
empty line above the done items separator."
(let* ((done (todo-done-item-p)))
(todo-item-start)
(unless (bobp)
(re-search-backward (concat todo-item-start
"\\( " diary-time-regexp "\\)?"
(regexp-quote todo-nondiary-end) "? ")
nil t (or count 1))
;; If the item date-time header is hidden, the display engine
;; moves point to the next earlier displayable position, which
;; is the end of the next item above, so we move it to the start
;; of the current item's text (that's what the display engine
;; does with todo-forward-item in this case.)
;; FIXME: would it be better to use cursor-sensor-functions?
(when todo--item-headers-hidden (goto-char (match-end 0))))
;; Unless this is a regexp filtered items buffer (which can contain
;; intermixed todo and done items), if points advances by one from a
;; done to a todo item, go back to the space above
;; todo-done-separator, since that is a legitimate place to insert an
;; item. But skip this space if count > 1, since that should only
;; stop on an item.
(when (and done (not (todo-done-item-p)) (not count)
;(or (not count) (= count 1))
(not (equal (buffer-name) todo-regexp-items-buffer)))
(re-search-forward (concat "^" (regexp-quote todo-category-done))
nil t)
(forward-line -1))))