2

In Emacs org-mode, I like to use TODO items. I switched on the automatic closing note, when an entry is marked DONE.

A small annoyance is that the fill behavior of the closing note usually changes from the *Org Note* buffer, where the message is entered, to the original Org-file. To have the right filling after inserting the closing note, I have to scroll down a few lines and use the M-q (fill-paragraph).

Is there a possibility to have automatic filling for the closing note?

1

You could adjust the value of fill-column in the Org note buffer. If org-adapt-indentation is non-nil, this needs to take into account the heading level.

(defvar org-log-current-level nil)
(advice-add 'org-add-log-note :before
            (lambda ()
              (setq org-log-current-level (org-current-level))))

(defun org-log-adjust-fill-column ()
  (let ((offset (if org-adapt-indentation (+ org-log-current-level 3) 2)))
    (setq fill-column (- fill-column offset))))

(add-hook 'org-log-buffer-setup-hook #'org-log-adjust-fill-column)
  • I just tried to see if this works. Sadly I'm using Emacs 24.3 and the advice-add does not exist... Is there an easy way to work around this? – jjokella Jul 4 '15 at 15:40
  • Ok, I now tried it with an Emacs 24.4, which I do not use for AucTeX compatibility issues, but it works for some first tries, so I mark the answer with the green hook. Thanks! – jjokella Jul 4 '15 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.