summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-02-19 11:04:26 +0100
committerBastien Guerry <bzg@altern.org>2013-02-19 11:04:26 +0100
commit9bec2ec5d017caaf493d9f6c6757b32ce33c83d0 (patch)
tree8eeb7f6c1952806b44a065eab94dda8886eccdfc
parent66cba1c51f0d0c71f1bc2698d764401347646233 (diff)
downloadorg-mode-9bec2ec5d017caaf493d9f6c6757b32ce33c83d0.tar.gz
org-agenda.el: Small bug fixes
* org-agenda.el (org-agenda-unmark-clocking-task): New function. (org-agenda-mark-clocking-task): Use it. (org-agenda-clock-in): Let the cursor where it is. (org-agenda-clock-out): Ditto. Also remove the `org-agenda-clocking' overlay.
-rw-r--r--lisp/org-agenda.el25
1 files changed, 16 insertions, 9 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 0030082..b0514ff 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3765,10 +3765,7 @@ generating a new one."
(defun org-agenda-mark-clocking-task ()
"Mark the current clock entry in the agenda if it is present."
- (mapc (lambda (o)
- (if (eq (overlay-get o 'type) 'org-agenda-clocking)
- (delete-overlay o)))
- (overlays-in (point-min) (point-max)))
+ (org-agenda-unmark-clocking-task)
(when (marker-buffer org-clock-hd-marker)
(save-excursion
(goto-char (point-min))
@@ -3783,6 +3780,13 @@ generating a new one."
(overlay-put ov 'help-echo
"The clock is running in this item")))))))
+(defun org-agenda-unmark-clocking-task ()
+ "Unmark the current clocking task."
+ (mapc (lambda (o)
+ (if (eq (overlay-get o 'type) 'org-agenda-clocking)
+ (delete-overlay o)))
+ (overlays-in (point-min) (point-max))))
+
(defun org-agenda-fontify-priorities ()
"Make highest priority lines bold, and lowest italic."
(interactive)
@@ -9141,9 +9145,9 @@ ARG is passed through to `org-deadline'."
(org-clock-in arg)
(let* ((marker (or (org-get-at-bol 'org-marker)
(org-agenda-error)))
- (hdmarker (or (org-get-at-bol 'org-hd-marker)
- marker))
+ (hdmarker (or (org-get-at-bol 'org-hd-marker) marker))
(pos (marker-position marker))
+ (col (current-column))
newhead)
(org-with-remote-undo (marker-buffer marker)
(with-current-buffer (marker-buffer marker)
@@ -9154,14 +9158,15 @@ ARG is passed through to `org-deadline'."
(org-cycle-hide-drawers 'children)
(org-clock-in arg)
(setq newhead (org-get-heading)))
- (org-agenda-change-all-lines newhead hdmarker)))))
+ (org-agenda-change-all-lines newhead hdmarker))
+ (org-move-to-column col))))
(defun org-agenda-clock-out ()
"Stop the currently running clock."
(interactive)
(unless (marker-buffer org-clock-marker)
(error "No running clock"))
- (let ((marker (make-marker)) newhead)
+ (let ((marker (make-marker)) (col (current-column)) newhead)
(org-with-remote-undo (marker-buffer org-clock-marker)
(with-current-buffer (marker-buffer org-clock-marker)
(save-excursion
@@ -9173,7 +9178,9 @@ ARG is passed through to `org-deadline'."
(org-clock-out)
(setq newhead (org-get-heading))))))
(org-agenda-change-all-lines newhead marker)
- (move-marker marker nil)))
+ (move-marker marker nil)
+ (org-move-to-column col)
+ (org-agenda-unmark-clocking-task)))
(defun org-agenda-clock-cancel (&optional arg)
"Cancel the currently running clock."