summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2011-03-08 10:40:46 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2011-03-08 10:40:46 +0100
commit11f19abcf2793ddc57bf36ac157cbfcf8c58c66c (patch)
treea8de4ccb9bfc840be442bcaf06eeef33cef1c87b
parent4fc3e71f10f238cd2461b785b8ec1b0ecb4ec16b (diff)
downloadorg-mode-11f19abcf2793ddc57bf36ac157cbfcf8c58c66c.tar.gz
org-timer: fix bug with `org-timer-item'
* lisp/org-timer.el (org-timer-item): save-excursion prevents `org-list-struct' to get the list structure when point isn't on the first line of the item.
-rw-r--r--lisp/org-timer.el9
1 files changed, 4 insertions, 5 deletions
diff --git a/lisp/org-timer.el b/lisp/org-timer.el
index aaa496e..7cf4f0e 100644
--- a/lisp/org-timer.el
+++ b/lisp/org-timer.el
@@ -207,21 +207,20 @@ it in the buffer."
(defun org-timer-item (&optional arg)
"Insert a description-type item with the current timer value."
(interactive "P")
- (let ((itemp (org-in-item-p)))
+ (let ((itemp (org-in-item-p)) (pos (point)))
(cond
;; In a timer list, insert with `org-list-insert-item',
;; then fix the list.
- ((and itemp
- (save-excursion (goto-char itemp) (org-at-item-timer-p)))
+ ((and itemp (goto-char itemp) (org-at-item-timer-p))
(let* ((struct (org-list-struct))
(prevs (org-list-prevs-alist struct))
(s (concat (org-timer (when arg '(4)) t) ":: ")))
- (setq struct (org-list-insert-item (point) struct prevs nil s))
+ (setq struct (org-list-insert-item pos struct prevs nil s))
(org-list-write-struct struct (org-list-parents-alist struct))
(looking-at org-list-full-item-re)
(goto-char (match-end 0))))
;; In a list of another type, don't break anything: throw an error.
- (itemp (error "This is not a timer list"))
+ (itemp (goto-char pos) (error "This is not a timer list"))
;; Else, start a new list.
(t
(beginning-of-line)