1

I have an org-mode list.

1) John
2) Paul
3) Jimmy
4) George
5) Ringo

I've decided that item number three doesn't belong on this list. I can purge this item by removing it and then issuing C-c C-c and the list updates.

1) John
2) Paul
3) George
4) Ringo

Is there a command to do this automatically?

2

There is no command that I am aware of.

But one can adapt the code of org-move-item-down to that task:

(defun org+-kill-list-item (&optional delete)
  "Kill list item at POINT.
Delete if DELETE is non-nil.
In interactive calls DELETE is the prefix arg."
  (interactive "P")
  (unless (org-at-item-p) (error "Not at an item"))
  (let* ((col (current-column))
         (item (point-at-bol))
         (struct (org-list-struct)))
    (org-list-send-item item (if delete 'delete 'kill) struct)
    (org-list-write-struct struct (org-list-parents-alist struct))
    (org-list-repair)
    (org-move-to-column col)))

Tested with Emacs 26.3 and Org 9.2.3.

| improve this answer | |

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.