0

I'm trying to customize the fill-column value for org-add-note when adding notes to an Org TODO (e.g., C-c C-z).

I have tried to add the following to the org-add-note function (this seems reasonable from the add-hook documentation).

(add-hook #'org-add-note (lambda () (setq fill-column 72)))

However, it doesn't seem to work, I get the following in the *Messages* buffer:

Fill column set to 79 (was 70)

Since it was 70 and no other messages indicating otherwise, this tells me it was never 72, which means there's nothing else in my configuration overriding the hook value.

Setting the global org-mode fill-column won't work since this customization is to work around Org-mode indenting the notes in the drawers of the TODO, which takes off about 5 spaces already. That is, setting a custom fill-column value for any buffer in Org mode doesn't solve the problem.

Perhaps the solution is have a function that checks the buffer name? If the buffer name is "*Org Note*" in Org mode, set to fill-column to 72, otherwise, leave it alone or use the "default".

Any help is much appreciated!

1 Answer 1

1

Usually hooks have names that end in -hook or -functions, so org-add-note is probably not the name of the hook you need to use.

Based on looking at the code, I'd suggest you use something like:

(add-hook 'org-log-buffer-setup-hook #'my-set-fill-column)
(defun my-set-fill-column () (setq-local fill-column 72))
3
  • Is there any particularly reason for defun over a lambda? Extensibility? Actually, why does this work with a named function and not a lambda?
    – kballou
    Commented Jul 15, 2019 at 17:02
  • Turns out my issue with respect to named functions versus lambda and working and not working turns out to be setq-local versus setq. They both work, I will need to research the difference between those two. Thank you for your help!
    – kballou
    Commented Jul 15, 2019 at 17:11
  • No, the only important difference is the name of the hook (i.e. org-log-buffer-setup-hook instead of org-add-note).
    – Stefan
    Commented Jul 15, 2019 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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