6

Is there a way to make a logbook-like note without it always being stuck in a :LOGBOOK drawer? For example:

- [2015-09-02 Wed 18:03] \\
    * 12.3 Export settings             :om:htmlexport:
      - Up: Exporting
      - [[http://orgmode.org/manual/Export-settings.html][Export settings]]

I like being able to just stick a timestamped observation anywhere with C-c C-z. Is there any way to turn off the automatic :LOGBOOK drawer?

7

Where org-add-note sticks the note is controlled by org-log-into-drawer. If it's nil your notes go into the body instead of the logbook drawer. If you set org-log-into-drawer to nil you may also want to set org-log-state-notes-insert-after-drawers which will ensure that the notes go after LOGBOOK and PROPERTIES.

I've been using this bit of advice to let me pick where notes go. With a C-u prefix they go in the body, otherwise they go into LOGBOOK

(defun with-no-drawer (func &rest args)
  (interactive "P")
  (let ((org-log-into-drawer (not (car args))))
    (funcall func)))

(advice-add 'org-add-note :around #'with-no-drawer)
2

New here with no-reputation, otherwise I would simply have added a comment to erikstokes answer.

Using org-mode version 8.3.4 the advise above was not sufficient as org-add-note() had completed before org-store-log-note() callback function had been called.

So I took his example and made it two pronged:

(defun sjm/org-add-note (func &rest args)
  "Set sjm/org-log-into-drawer to value of args (c-u), its value is read by sjm/org-store-log-note."
  (interactive "P")
  (setq sjm/org-log-into-drawer (car args))
  (funcall func))

(defun sjm/org-store-log-note (func)
  "calls org-store-log-note momentarily setting
org-log-into-drawer to nil if sjm/org-log-into-drawer is nil. As set by sjm/org-add-note."
  (if (not sjm/org-log-into-drawer)
      (funcall func)
    (let ((org-log-into-drawer nil))
      (funcall func))))

(advice-add 'org-add-note :around #'sjm/org-add-note)
(advice-add 'org-store-log-note :around #'sjm/org-store-log-note)

As it stands sjm/org-log-into-drawer is a global switch, but then so is the buffer *Org Note*; meaning you can only take one note at a time anyway!

1

This is what worked for:

(defun with-no-drawer (func &rest args)
    (interactive "P")
    (if (eq org-log-note-purpose 'note)
        (let ((org-log-state-notes-insert-after-drawers t))
          (flet ((org-log-into-drawer (&rest args) nil))
            (apply func args)))
      (apply func args)))
(advice-add 'org-log-beginning :around #'with-no-drawer)

org-log-beginning needs to be advised because org-add-note simply sets up post-command hook and advice operates only during that setup.

0

You can also change it by emacs' graphic interface:

m-x customize-variable org-log-into-drawer

then click in Value Menu menu and choose an option.

Note that if you change it this way, it automatically added an entry in your emacs config file such as:

(custom-set-variables
 '(org-log-into-drawer t))

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.