Sławomir Grochowski <[email protected]> writes:

> I think the read-only text property in column view is actually fine.
> Editing properties from column view already works via org-set-property'
> / org-entry-put', because org-entry-put' wraps its buffer-modifying body
> in `org-no-read-only'.  The same pattern can apply to log notes.
>
> The attached patch wraps the buffer-modifying sections of
> `org-store-log-note' and `org-log-beginning' in `org-no-read-only',
> mirroring `org-entry-put'.

I thought about this idea.
If we cannot find anything better, it may be ok.
However, I am afraid that we may have to add `org-no-read-only' to more
and more places, which will eventually surprise users - Org will modify
text in read-only buffers, even when users enabled that mode
deliberately.
If you have no better ideas, I am ok to merge the patch. This bug is
indeed quite annoying.

> Two notes on the patch shape — both deliberate, to keep review easy:
>
> - The diff in lisp/org.el' is 6/4 lines.  I did not re-indent the
> wrapped bodies after adding the outer org-no-read-only', so the inner
> forms sit one column to the left of their canonical position.
> Re-indenting would have produced ~130 changed lines for no semantic
> gain; leaving it as-is keeps the change reviewable as "just add a wrap".
> Happy to follow up with a whitespace-only re-indent commit if you prefer
> the canonical form.  - The inner (let ((inhibit-read-only t))
> (insert-and-inherit "\n"))' inside org-store-log-note' is now redundant
> -- the outer `org-no-read-only' already binds it.  I left it in place
> intentionally for the same minimal-diff reason; behavior is identical.
> Happy to remove it in a follow-up.

We generally do no use whitespace-only commits, following what Emacs
does (see https://orgmode.org/worg/org-contribute.html#patches). As
for 130 changes lines, they are very easy to deal with if you enable
`magit-diff-refine-hunk' (it is the default in built-in diff-mode -
`diff-refine').

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