org-columns: Fix when adding spaces to headings

* lisp/org-colview.el (org-columns): Use markers to store collected
column headline value positions.  This is necessary because
`org-columns--display-here' may modify buffer, invalidating headline
positions returned by `org-scan-tags'.

Reported-by: Jakob Schöttl <jschoett@gmail.com>
Link: https://orgmode.org/list/831f07e0-d86a-a0dc-c967-e48906f520a1@gmail.com
This commit is contained in:
Ihor Radchenko 2023-08-20 11:54:20 +03:00
parent 06714dea79
commit 58c5c5882c
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 2 additions and 1 deletions

View File

@ -888,7 +888,7 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format."
;; Collect contents of columns ahead of time so as to
;; compute their maximum width.
(org-scan-tags
(lambda () (cons (point) (org-columns--collect-values))) t org--matcher-tags-todo-only)))
(lambda () (cons (point-marker) (org-columns--collect-values))) t org--matcher-tags-todo-only)))
(when cache
(org-columns--set-widths cache)
(org-columns--display-here-title)
@ -902,6 +902,7 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format."
(setq truncate-lines t))
(dolist (entry cache)
(goto-char (car entry))
(move-marker (car entry) nil)
(org-columns--display-here (cdr entry)))))))))
(defun org-columns-new (&optional spec &rest attributes)