From 1e268ad334fad655f3f2748143206b54f18a1d6c Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 12 Aug 2015 14:49:02 +0200 Subject: [PATCH] org-colview: Fix column view area * lisp/org-colview.el (org-columns-goto-top-level): Actually move point. (org-columns): Adapt to change above. Reported-by: Johan Sandblom --- lisp/org-colview.el | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 8ba8c97fe..3838531ab 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -680,11 +680,14 @@ around it." fmt)) (defun org-columns-goto-top-level () - (when (condition-case nil (org-back-to-heading) (error nil)) - (org-entry-get nil "COLUMNS" t)) - (if (marker-position org-entry-property-inherited-from) - (move-marker org-columns-top-level-marker org-entry-property-inherited-from) - (move-marker org-columns-top-level-marker (point)))) + "Move to the beginning of the column view area. +Also sets `org-columns-top-level-marker' to the new position." + (goto-char + (move-marker + org-columns-top-level-marker + (cond ((org-before-first-heading-p) (point-min)) + ((org-entry-get nil "COLUMNS" t) org-entry-property-inherited-from) + (t (org-back-to-heading) (point)))))) ;;;###autoload (defun org-columns (&optional columns-fmt-string) @@ -703,9 +706,8 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format." (save-excursion (save-restriction (narrow-to-region - org-columns-top-level-marker - (or (ignore-errors (org-end-of-subtree t t)) (point-max))) - (goto-char (point-min)) + (point) + (if (org-at-heading-p) (org-end-of-subtree t t) (point-max))) (when (assoc "CLOCKSUM" org-columns-current-fmt-compiled) (org-clock-sum)) (when (assoc "CLOCKSUM_T" org-columns-current-fmt-compiled)