diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index f7acce32d..0c41a7a3c 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3720,12 +3720,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)) @@ -3762,20 +3757,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." @@ -9949,6 +9949,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) diff --git a/lisp/org-table.el b/lisp/org-table.el index da3aab814..c996b7cae 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -1247,6 +1247,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)) diff --git a/lisp/org.el b/lisp/org.el index 5ed36a93b..01bf81899 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8716,7 +8716,7 @@ When sorting is done, call `org-after-sorting-entries-or-items-hook'." (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)