Ihor Radchenko <[email protected]> writes:

> Sławomir Grochowski <[email protected]> writes:
>
>> I have noticed that `org-add-note' doesn't work in column view when
>> a heading doesn't have any drawer. It throws an error on save: 'Text is 
>> read-only...'.
>>
>> To fix that, I added (let ((inhibit-read-only t)) some-function)
>> before any function that was causing this error.
>>
>> I'm not sure this is the right approach. It feels somewhat hackish to
>> me, but it works.
>
> Yeah, this is hacky. I imagine similar problems in other Org commands
> that modify buffer while column view is active.
> What about modifying `org-columns--display-here' to not put read-only
> onto newline after the heading?

Here is a tentative patch that should fix the problem.
Can you please test?

>From 4d380a365bddfe3c2e05b153f277bbb0d9d14434 Mon Sep 17 00:00:00 2001
Message-ID: <4d380a365bddfe3c2e05b153f277bbb0d9d14434.1766775174.git.yanta...@posteo.net>
From: Ihor Radchenko <[email protected]>
Date: Fri, 26 Dec 2025 19:50:43 +0100
Subject: [PATCH] org-columns: Do not interfere with editing commands like C-c
 C-z
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/org-colview.el (org-columns--display-here): Allow inserting
after newline in headings when column view is active.  By default,
'read-only overlay property is rear-sticky, so that inserted text
after may inherit it (interactively, or when using
`insert-and-inherit'), which triggers an error as inserting a new
character with inherited 'read-only constitutes a change and triggers
an error.

Reported-by: Sławomir Grochowski <[email protected]>
Link: https://orgmode.org/list/87ecrsxaf6.fsf@localhost
---
 lisp/org-colview.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index fa54d629f..b52b15f15 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -466,6 +466,11 @@ (defun org-columns--display-here (columns &optional dateline)
 	(push ov org-columns-overlays))
       (with-silent-modifications
 	(let ((inhibit-read-only t))
+          ;; Allow edits like adding a note.
+          (put-text-property
+           (line-end-position 0)
+	   (1+ (line-end-position 0))
+           'rear-nonsticky t)
 	  (put-text-property
 	   (line-end-position 0)
 	   (line-beginning-position 2)
-- 
2.52.0

-- 
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