Dear all, 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. Feedback would be appreciated. Patch below:
>From 52384dd4bb87b0e1e0a06ef2e10647efd55331ad Mon Sep 17 00:00:00 2001 From: Slawomir Grochowski <slawomir.grochow...@gmail.com> Date: Fri, 29 Aug 2025 22:18:32 +0200 Subject: [PATCH] lisp/org.el: Allow org-add-note in column-view * org.el (org-store-log-note): Add (inhibit-read-only t) in a few places to allow to `org-add-note' work in column-view. --- lisp/org.el | 56 +++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 21622523b..7c2cd937d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10835,27 +10835,28 @@ narrowing." (and (bolp) (not (eolp))))) (unless (bolp) ;; Heading<point> (see `backward-char' branch above) - (insert-and-inherit "\n")) + (let ((inhibit-read-only t)) (insert-and-inherit "\n"))) (let ((beg (point)) cbeg) - (insert-and-inherit ":" drawer ":") - (setq cbeg (point)) - (insert-and-inherit "\n:END:") - (cond - (at-blank-line? - ;; Heading - ;; :LOGBOOK: - ;; :END: - ;; - ;; Text - (insert "\n") - (backward-char)) - (at-beginning-of-non-blank-line? - ;; Heading - ;; :LOGBOOK: - ;; :END: - ;; Text - (insert "\n") - (backward-char))) + (let ((inhibit-read-only t)) + (insert-and-inherit ":" drawer ":") + (setq cbeg (point)) + (insert-and-inherit "\n:END:") + (cond + (at-blank-line? + ;; Heading + ;; :LOGBOOK: + ;; :END: + ;; + ;; Text + (insert "\n") + (backward-char)) + (at-beginning-of-non-blank-line? + ;; Heading + ;; :LOGBOOK: + ;; :END: + ;; Text + (insert "\n") + (backward-char)))) (org-indent-region beg (point)) (org-fold-region cbeg (point) t 'drawer))))) (end-of-line 0)))) @@ -11015,7 +11016,7 @@ items are State notes." (goto-char (org-log-beginning t))) ;; Make sure point is at the beginning of an empty line. (cond ((not (bolp)) (let ((inhibit-read-only t)) (insert-and-inherit "\n"))) - ((looking-at "[ \t]*\\S-") (save-excursion (insert-and-inherit "\n")))) + ((looking-at "[ \t]*\\S-") (save-excursion (let ((inhibit-read-only t)) (insert-and-inherit "\n"))))) ;; In an existing list, add a new item at the top level. ;; Otherwise, indent line like a regular one. (let ((itemp (org-in-item-p))) @@ -11025,13 +11026,14 @@ items are State notes." (goto-char itemp) (org-list-struct)))) (org-list-get-ind (org-list-get-top-point struct) struct))) (org-indent-line))) - (insert-and-inherit (org-list-bullet-string "-") (pop lines)) + (let ((inhibit-read-only t)) (insert-and-inherit (org-list-bullet-string "-") (pop lines))) (let ((ind (org-list-item-body-column (line-beginning-position)))) - (dolist (line lines) - (insert-and-inherit "\n") - (unless (string-empty-p line) - (indent-line-to ind) - (insert-and-inherit line)))) + (let ((inhibit-read-only t)) + (dolist (line lines) + (insert-and-inherit "\n") + (unless (string-empty-p line) + (indent-line-to ind) + (insert-and-inherit line))))) (run-hooks 'org-after-note-stored-hook) (message "Note stored") (org-back-to-heading t)))))) -- 2.39.5
-- Slawomir Grochowski