0

Currently when I need to remove a property drawer under an entry:

  • I have move to either the beginning (:PROPERTIES) or the end (:END:)
  • Then press Tab to fold (hide) the drawer.
  • And finally delete the line, which has the effect of deleting the whole folded drawer.

These 3 steps operation can be cumbersome sometimes and I'd like to be able to remove a whole properties drawer in one key binding, with the point starting anywhere inside.

Looking at the doc and provided functions in Org-mode, I can't find such a function. I searched for a combination of terms like org delete, org remove, org drawer… without success.

I did found related functions like : org-insert-drawer or org-remove-empty-drawer-at, but not the one I need.

Am I missing something obvious? Which pieces are needed to design my own? Thanks.

1 Answer 1

2

You could use the org-element-api to create a custom interactive function (command) for this, e.g.:

(defun my-kill-drawer ()
  (interactive)
  (let ((element (org-element-context)))
    (unless (eq (car element) 'drawer)
      (setq element (org-element-property :parent element)))
    (kill-region (org-element-property :begin element)
                 (org-element-property :end element))))
1
  • 1
    @NickD Thanks, you are right, it's a remnant of the 'design process'. I have removed it from the answer... Jun 9, 2022 at 9:17

Your Answer

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

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