Here's my proposed change: You were right about the side effect. I removed (forward-char) from the helper and moved it into the loop:
`org-columns--display-here-column' now only installs an overlay at point, with no cursor movement. `org-columns--display-columns' does the (forward-char) explicitly after each column in the dolist, so the iteration is visible at the call site. While at it, I reordered the display functions so they sit together in a single block. I'm also not thrilled with the function names — display-here-column and display-columns don't really convey what they do (one installs an overlay, the other loops and advances point). Open to suggestions if you have better names in mind. Both commits are below. Best, -- Slawomir Grochowski
>From 156c20508881f50aaeef6e8e9bbb184b4e5b0b16 Mon Sep 17 00:00:00 2001 From: Slawomir Grochowski <[email protected]> Date: Sun, 10 May 2026 16:03:47 +0200 Subject: [PATCH 1/2] org-colview.el: Reorder display functions for logical grouping * lisp/org-colview.el (org-columns--display-here-column): Move function definition after org-columns--display-columns so that the column display helpers sit together in a single block. Pure code movement, no behavioral change. --- lisp/org-colview.el | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lisp/org-colview.el b/lisp/org-colview.el index f78d4fcb6..cc00061b8 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -450,25 +450,6 @@ DATELINE non-nil selects the agenda dateline variant." (if dateline 'org-agenda-column-dateline 'org-column) ref-face))) -(defun org-columns--display-here-column (value fmt width property original face) - "Place an overlay rendering one column on the next character at point. -The overlay covers a single character starting at point and shows VALUE -formatted with FMT to WIDTH, associated with column PROPERTY whose -unmodified value is ORIGINAL. FACE is applied to the overlay. Point -advances by one character so the next column may be installed." - (let ((ov (org-columns--new-overlay - (point) (1+ (point)) - (org-columns--overlay-text value fmt width property original) - face))) - (overlay-put ov 'keymap org-columns-map) - (overlay-put ov 'org-columns-key property) - (overlay-put ov 'org-columns-value original) - (overlay-put ov 'org-columns-value-modified value) - (overlay-put ov 'org-columns-format fmt) - (overlay-put ov 'line-prefix "") - (overlay-put ov 'wrap-prefix "")) - (forward-char)) - (defun org-columns--mark-line-read-only () "Mark the column view rendered line as read-only. The property covers from the previous line-end through the next @@ -505,6 +486,25 @@ to edit property"))))))) value fmt width property original face)))) (cl-incf i)))) +(defun org-columns--display-here-column (value fmt width property original face) + "Place an overlay rendering one column on the next character at point. +The overlay covers a single character starting at point and shows VALUE +formatted with FMT to WIDTH, associated with column PROPERTY whose +unmodified value is ORIGINAL. FACE is applied to the overlay. Point +advances by one character so the next column may be installed." + (let ((ov (org-columns--new-overlay + (point) (1+ (point)) + (org-columns--overlay-text value fmt width property original) + face))) + (overlay-put ov 'keymap org-columns-map) + (overlay-put ov 'org-columns-key property) + (overlay-put ov 'org-columns-value original) + (overlay-put ov 'org-columns-value-modified value) + (overlay-put ov 'org-columns-format fmt) + (overlay-put ov 'line-prefix "") + (overlay-put ov 'wrap-prefix "")) + (forward-char)) + (defun org-columns--hide-rest-of-line () "Make the rest of the line disappear using overlays." (let ((ov (org-columns--new-overlay (point) (line-end-position)))) -- 2.39.5
>From 46b0fd2529757992a74c140072bfda02714c6860 Mon Sep 17 00:00:00 2001 From: Slawomir Grochowski <[email protected]> Date: Sun, 10 May 2026 16:21:06 +0200 Subject: [PATCH 2/2] org-colview.el: Move point advancement out of display-here-column * lisp/org-colview.el (org-columns--display-here-column): Remove the (forward-char) side effect. The function now only installs a single column overlay at point, with no hidden cursor movement. (org-columns--display-columns): Add (forward-char) after each column installation in the dolist loop, making the iteration explicit at the call site. --- lisp/org-colview.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lisp/org-colview.el b/lisp/org-colview.el index cc00061b8..8b23e2757 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -473,7 +473,7 @@ to edit property"))))))) (face-remap-add-relative 'header-line '(:inherit default))))) (defun org-columns--display-columns (columns face) - "Create and install the overlay for each column on the next character." + "Install overlays for each COLUMN, advancing point after each one." (let ((i 0) (last (1- (length columns)))) (dolist (column columns) @@ -484,14 +484,14 @@ to edit property"))))))) (fmt (org-columns--overlay-fmt width (= i last)))) (org-columns--display-here-column value fmt width property original face)))) + (forward-char) (cl-incf i)))) (defun org-columns--display-here-column (value fmt width property original face) - "Place an overlay rendering one column on the next character at point. + "Install an overlay rendering one column at point. The overlay covers a single character starting at point and shows VALUE formatted with FMT to WIDTH, associated with column PROPERTY whose -unmodified value is ORIGINAL. FACE is applied to the overlay. Point -advances by one character so the next column may be installed." +unmodified value is ORIGINAL. FACE is applied to the overlay." (let ((ov (org-columns--new-overlay (point) (1+ (point)) (org-columns--overlay-text value fmt width property original) @@ -502,8 +502,7 @@ advances by one character so the next column may be installed." (overlay-put ov 'org-columns-value-modified value) (overlay-put ov 'org-columns-format fmt) (overlay-put ov 'line-prefix "") - (overlay-put ov 'wrap-prefix "")) - (forward-char)) + (overlay-put ov 'wrap-prefix ""))) (defun org-columns--hide-rest-of-line () "Make the rest of the line disappear using overlays." -- 2.39.5
