Position items with relative timer at the right place.

* org-timer.el (org-timer-item): Insert description list item at the
  right column.
* org-list.el (org-insert-item): Insert the right number of blank
  lines before a relative timer.
This commit is contained in:
Nicolas Goaziou 2010-07-14 16:31:01 +02:00
parent 292b52f596
commit 2b8aa4c406
2 changed files with 11 additions and 10 deletions

View File

@ -664,8 +664,12 @@ block, or item is invisible."
(unless before-p (org-move-item-down)))))
(goto-char pos)
(cond
;; if we're adding a timer, delegate to `org-timer-item'.
(timer-p (org-timer-item) t)
;; if we're adding a timer, delegate to `org-timer-item' after
;; inserting a coherent number of blank lines.
(timer-p
(newline (1+ blank-lines-nb))
(org-timer-item)
t)
(before-p
(funcall insert-fun)
;; Renumber in this case, as we're not moving down.

View File

@ -195,14 +195,11 @@ that was not started at the correct moment."
(defun org-timer-item (&optional arg)
"Insert a description-type item with the current timer value."
(interactive "P")
(let ((ind 0))
(save-excursion
(skip-chars-backward " \n\t")
(condition-case nil
(progn
(org-beginning-of-item)
(setq ind (org-get-indentation)))
(error nil)))
(let ((ind (save-excursion
(if (not (org-in-item-p))
(org-indent-line-function)
(org-beginning-of-item)
(org-get-indentation)))))
(or (bolp) (newline))
(org-indent-line-to ind)
(insert "- ")