2014/1/23 Cecil Westerhof <[email protected]>
> I also think it would be a good idea to change
> (org-list-send-item item 'end struct)
> to a call to a function. I think it would be useful to have a function to
> send a item to the end (or begin) of a list.
>
I know have the following:
(defun dcbl-check-checkbox-and-move-to-end ()
(interactive)
(save-excursion
(let* ((struct (org-list-struct))
(struct-old (copy-tree struct))
(item (line-beginning-position))
(item-checkbox-type (org-list-get-checkbox item struct)))
(if (not item-checkbox-type)
(message "No checkbox found")
(if (string-equal item-checkbox-type "[X]")
(message "Checkbox already checked")
(org-list-set-checkbox item struct "[X]")
(org-list-write-struct struct (org-list-parents-alist struct)
struct-old)
(dcbl-move-item-to-end-of-list item))))))
(defun dcbl-move-item-to-begin-of-list (&optional item)
(interactive)
(save-excursion
(when item
(goto-char item))
(org-list-send-item (line-beginning-position) 'begin (org-list-struct)))
(previous-line))
(defun dcbl-move-item-to-end-of-list (&optional item)
(interactive)
(save-excursion
(when item
(goto-char item))
(org-list-send-item (line-beginning-position) 'end (org-list-struct))))
(global-set-key [?\C-c ?\M-a] 'dcbl-move-item-to-begin-of-list)
(global-set-key [?\C-c ?\M-c] 'dcbl-check-checkbox-and-move-to-end)
(global-set-key [?\C-c ?\M-e] 'dcbl-move-item-to-end-of-list)
--
Cecil Westerhof