From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Marcelo de Moraes Serpa <celoserpa@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Move to item to the bottom
Date: Thu, 30 Jun 2011 20:55:16 +0200 [thread overview]
Message-ID: <878vsjb14b.fsf@gmail.com> (raw)
In-Reply-To: <BANLkTiksd8HAU5bu-=FqchGbSfsP7ULv5A@mail.gmail.com> (Marcelo de Moraes Serpa's message of "Thu, 30 Jun 2011 11:13:03 -0500")
Hello,
Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
> It'd be nice if we could just send an item to the bottom of a list. Useful
> when reviewing a long list and putting the next actions in the top. Is there
> a way to do that with org currently?
Not heavily tested, but something like the following snippet should
work:
#+begin_src emacs-lisp
(defun ngz-move-item-at-bottom ()
"Move item at point at the bottom of the list.
Note that the item will be become the last item of the top-level
list, whatever its original indentation was."
(interactive)
(if (not (org-at-item-p))
(error "Not in a list")
(let* ((item (point-at-bol))
(struct (org-list-struct))
(top-item (org-list-get-top-point struct))
(end (org-list-get-item-end item struct))
(bullet (org-list-get-bullet item struct))
(body (org-trim
(buffer-substring (progn (looking-at (concat "[ \t]*" bullet))
(match-end 0))
end)))
(prevs (org-list-prevs-alist struct))
(last-top-level-item (org-list-get-last-item top-item struct prevs))
(ins-point (save-excursion (goto-char last-top-level-item)
(point-at-eol)))
(org-M-RET-may-split-line nil))
(if (= item last-top-level-item)
(error "Item is already at the bottom of the list")
(save-excursion (org-list-insert-item ins-point struct prevs nil body))
(delete-region item end)))))
#+end_src
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2011-06-30 18:55 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-30 16:13 Move to item to the bottom Marcelo de Moraes Serpa
2011-06-30 18:55 ` Nicolas Goaziou [this message]
2011-07-01 6:35 ` Nicolas Goaziou
2011-07-01 8:57 ` Bastien
2011-07-01 9:10 ` Nicolas Goaziou
2011-07-01 9:32 ` Bastien
2011-07-02 19:25 ` Nicolas Goaziou
2011-07-03 2:02 ` Marcelo de Moraes Serpa
2011-07-03 9:39 ` Nicolas Goaziou
2011-07-05 3:27 ` Marcelo de Moraes Serpa
2011-07-07 15:51 ` Marcelo de Moraes Serpa
2011-07-20 16:05 ` Marcelo de Moraes Serpa
2011-07-27 11:22 ` Bastien
2011-07-27 23:12 ` Marcelo de Moraes Serpa
2011-07-01 9:34 ` Carsten Dominik
2011-07-01 9:46 ` Bastien
2011-07-01 10:25 ` Carsten Dominik
2011-07-01 16:07 ` Bastien
2011-07-01 16:59 ` Marcelo de Moraes Serpa
2011-07-01 19:25 ` Nicolas Goaziou
2011-07-01 22:58 ` Marcelo de Moraes Serpa
2011-07-02 8:05 ` Nicolas Goaziou
2011-07-02 9:06 ` Bastien
2011-07-01 10:14 ` Eric S Fraga
2011-07-01 10:27 ` Carsten Dominik
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878vsjb14b.fsf@gmail.com \
--to=n.goaziou@gmail.com \
--cc=celoserpa@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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).