瀏覽代碼

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.
Nicolas Goaziou 14 年之前
父節點
當前提交
2b8aa4c406
共有 2 個文件被更改,包括 11 次插入10 次删除
  1. 6 2
      lisp/org-list.el
  2. 5 8
      lisp/org-timer.el

+ 6 - 2
lisp/org-list.el

@@ -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.

+ 5 - 8
lisp/org-timer.el

@@ -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 "- ")