|
@@ -207,21 +207,20 @@ it in the buffer."
|
|
(defun org-timer-item (&optional arg)
|
|
(defun org-timer-item (&optional arg)
|
|
"Insert a description-type item with the current timer value."
|
|
"Insert a description-type item with the current timer value."
|
|
(interactive "P")
|
|
(interactive "P")
|
|
- (let ((itemp (org-in-item-p)))
|
|
|
|
|
|
+ (let ((itemp (org-in-item-p)) (pos (point)))
|
|
(cond
|
|
(cond
|
|
;; In a timer list, insert with `org-list-insert-item',
|
|
;; In a timer list, insert with `org-list-insert-item',
|
|
;; then fix the list.
|
|
;; 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))
|
|
(let* ((struct (org-list-struct))
|
|
(prevs (org-list-prevs-alist struct))
|
|
(prevs (org-list-prevs-alist struct))
|
|
(s (concat (org-timer (when arg '(4)) t) ":: ")))
|
|
(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))
|
|
(org-list-write-struct struct (org-list-parents-alist struct))
|
|
(looking-at org-list-full-item-re)
|
|
(looking-at org-list-full-item-re)
|
|
(goto-char (match-end 0))))
|
|
(goto-char (match-end 0))))
|
|
;; In a list of another type, don't break anything: throw an error.
|
|
;; 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.
|
|
;; Else, start a new list.
|
|
(t
|
|
(t
|
|
(beginning-of-line)
|
|
(beginning-of-line)
|