Function: todo-item-end

todo-item-end is a byte-compiled function defined in todo-mode.el.gz.

Signature

(todo-item-end)

Documentation

Move to end of current todo item and return its position.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/todo-mode.el.gz
(defun todo-item-end ()
  "Move to end of current todo item and return its position."
  (unless (or
           ;; Items cannot end with a blank line.
           (looking-at "^$")
           ;; Point is on done items separator.
           (save-excursion (beginning-of-line) (looking-at todo-category-done)))
    (let* ((done (todo-done-item-p))
	   (to-lim nil)
	   ;; For todo items, end is before the done items section, for done
	   ;; items, end is before the next category.  If these limits are
	   ;; missing or inaccessible, end it before the end of the buffer.
	   (lim (if (save-excursion
		      (re-search-forward
		       (concat "^" (regexp-quote (if done
						     todo-category-beg
						   todo-category-done)))
		       nil t))
		    (progn (setq to-lim t) (match-beginning 0))
		  (point-max))))
      (when (bolp) (forward-char))	; Find start of next item.
      (goto-char (if (re-search-forward todo-item-start lim t)
		     (match-beginning 0)
		   (if to-lim lim (point-max))))
      ;; For last todo item, skip back over the empty line before the done
      ;; items section, else just back to the end of the previous line.
      (backward-char (when (and to-lim (not done) (eq (point) lim)) 2))
      (point))))