From 7fc6d3df3939e80b1261ed5cb8c77b389ee117af Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 30 Jan 2014 11:57:43 +0100 Subject: [PATCH 1/3] org-agenda.el (org-agenda-drag-line-forward): Call`org-agenda-mark-clocking-task' when done * org-agenda.el (org-agenda-drag-line-forward): Call `org-agenda-mark-clocking-task' when done. (org-agenda-mark-clocking-task): Small refactoring. --- lisp/org-agenda.el | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index d3ee38a46..a98ccba4c 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3718,12 +3718,7 @@ generating a new one." (org-agenda-fontify-priorities)) (when (and org-agenda-dim-blocked-tasks org-blocker-hook) (org-agenda-dim-blocked-tasks)) - ;; We need to widen when `org-agenda-finalize' is called from - ;; `org-agenda-change-all-lines' (e.g. in `org-agenda-clock-in') - (when org-clock-current-task - (save-restriction - (widen) - (org-agenda-mark-clocking-task))) + (org-agenda-mark-clocking-task) (when org-agenda-entry-text-mode (org-agenda-entry-text-hide) (org-agenda-entry-text-show)) @@ -3760,20 +3755,25 @@ generating a new one." (defun org-agenda-mark-clocking-task () "Mark the current clock entry in the agenda if it is present." - (org-agenda-unmark-clocking-task) - (when (marker-buffer org-clock-hd-marker) - (save-excursion - (goto-char (point-min)) - (let (s ov) - (while (setq s (next-single-property-change (point) 'org-hd-marker)) - (goto-char s) - (when (equal (org-get-at-bol 'org-hd-marker) - org-clock-hd-marker) - (setq ov (make-overlay (point-at-bol) (1+ (point-at-eol)))) - (overlay-put ov 'type 'org-agenda-clocking) - (overlay-put ov 'face 'org-agenda-clocking) - (overlay-put ov 'help-echo - "The clock is running in this item"))))))) + ;; We need to widen when `org-agenda-finalize' is called from + ;; `org-agenda-change-all-lines' (e.g. in `org-agenda-clock-in') + (when org-clock-current-task + (save-restriction + (widen) + (org-agenda-unmark-clocking-task) + (when (marker-buffer org-clock-hd-marker) + (save-excursion + (goto-char (point-min)) + (let (s ov) + (while (setq s (next-single-property-change (point) 'org-hd-marker)) + (goto-char s) + (when (equal (org-get-at-bol 'org-hd-marker) + org-clock-hd-marker) + (setq ov (make-overlay (point-at-bol) (1+ (point-at-eol)))) + (overlay-put ov 'type 'org-agenda-clocking) + (overlay-put ov 'face 'org-agenda-clocking) + (overlay-put ov 'help-echo + "The clock is running in this item"))))))))) (defun org-agenda-unmark-clocking-task () "Unmark the current clocking task." @@ -9952,6 +9952,7 @@ When the optional argument `backward' is non-nil, move backward." (move-beginning-of-line (funcall (if backward '1- '1+) arg)) (insert line) (org-agenda-reapply-filters) + (org-agenda-mark-clocking-task) (move-beginning-of-line 0))))) (defun org-agenda-drag-line-backward (arg) From ca69fdd88467cb65859c497770e00ebc717c9564 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 30 Jan 2014 11:58:28 +0100 Subject: [PATCH 2/3] org-table.el (org-table-field-info): Throw a user error when not at a table * org-table.el (org-table-field-info): Throw a user error when not at a table. --- lisp/org-table.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/org-table.el b/lisp/org-table.el index 4999f62fe..c95223411 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -1241,6 +1241,7 @@ is always the old value." (defun org-table-field-info (arg) "Show info about the current field, and highlight any reference at point." (interactive "P") + (unless (org-at-table-p) (user-error "Not at a table")) (org-table-get-specials) (save-excursion (let* ((pos (point)) From 3c71ab34dd4d8cc0706246383afc9af432dc4d1f Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 30 Jan 2014 11:59:25 +0100 Subject: [PATCH 3/3] org.el (org-sort-entries): Restore the point location when there is nothing to sort * org.el (org-sort-entries): Restore the point location when there is nothing to sort. --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index e607235b1..ded2dc78e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8637,7 +8637,7 @@ links." (show-all))) (setq beg (point)) - (if (>= beg end) (user-error "Nothing to sort")) + (when (>= beg end) (goto-char start) (user-error "Nothing to sort")) (looking-at "\\(\\*+\\)") (setq stars (match-string 1)