From: Cecil Westerhof <cldwesterhof@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Check checkbox and move to end of list
Date: Thu, 23 Jan 2014 01:46:05 +0100 [thread overview]
Message-ID: <CAG-LmmC_5-rJBQNvnRbPV-VG0Wsxq8HCfUzD3Hhumma7uqMr+Q@mail.gmail.com> (raw)
In-Reply-To: <CAG-LmmBMJvP3X32QepOb=+nEsbEO+JWkbWk2XZ_YuYB-r8h4Gw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1628 bytes --]
2014/1/23 Cecil Westerhof <cldwesterhof@gmail.com>
> 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
[-- Attachment #2: Type: text/html, Size: 2422 bytes --]
next prev parent reply other threads:[~2014-01-23 0:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-22 23:50 Check checkbox and move to end of list Cecil Westerhof
2014-01-23 0:46 ` Cecil Westerhof [this message]
2014-01-23 1:07 ` Cecil Westerhof
2014-01-23 19:51 ` Cecil Westerhof
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAG-LmmC_5-rJBQNvnRbPV-VG0Wsxq8HCfUzD3Hhumma7uqMr+Q@mail.gmail.com \
--to=cldwesterhof@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.