Slawomir Grochowski <[email protected]> writes:

> In the preceding refactoring, I separated collecting column view data
> from displaying it.
>
> Displaying the rows is not necessary when exporting them to a column view
> dynamic block.  I therefore propose using this separation to simplify
> the data flow: prepare and collect the rows directly, without rendering
> column overlays.
>
> This patch updates `org-columns--capture-view' to call
> `org-columns--prepare-rows' and read the values directly from the
> collected rows.

Thanks!

> -  (org-columns (not local) columns-format)
> -  (goto-char org-columns-top-level-marker)
> -  (let ((columns (length org-columns-current-fmt-compiled))
> -     (has-item (assoc "ITEM" org-columns-current-fmt-compiled))
> -     table)
> +  (org-columns-remove-overlays)

Do you need to remove the overlays here?

> +  (setq-local org-columns-global (not local))
> +  (let* ((rows (save-excursion
> +              (org-columns--prepare-rows (not local) columns-format)))
> +      (has-item (assoc "ITEM" org-columns-current-fmt-compiled))
> +      table)
> +    (goto-char org-columns-top-level-marker)

You moved goto-char *after* columns computation "(not local)". Not sure
if this is right.

> -          (push (cons (org-reduced-level (org-current-level)) (nreverse row))
> +          (push (cons (org-reduced-level (org-current-level)) row)
>                  table)))))
>       (if match
>           (concat match (and maxlevel (format "+LEVEL<=%d" maxlevel)))
>         (concat match (and maxlevel (format "+LEVEL<=%d" maxlevel)))
>       (and maxlevel (format "LEVEL<=%d" maxlevel)))
>     (and local 'tree)
>     'archive 'comment)
>    (dolist (row rows) (set-marker (car row) nil))
>    (org-columns-quit)

It might be that org-columns-quit becomes unnecessary if you do not have
overlays. Unless you rely on some specific side effects of org-columns-quit.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to