emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Jarmo Hurri <jarmo.hurri@iki.fi>
Cc: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: Continued lists
Date: Sat, 2 Nov 2019 13:20:26 -0400	[thread overview]
Message-ID: <CAJ51ETrU5LsnEMPUAduxP9qLOepVn=01is_-tktqy+wH5UdrWg@mail.gmail.com> (raw)
In-Reply-To: <87v9s2k4fc.fsf@iki.fi>

[-- Attachment #1: Type: text/plain, Size: 1912 bytes --]

It seems a little tricky to do much better.

With numbering you can do something like this where you find the last
element of the previous list, and then continue it. This won't do what you
want for nested lists I guess. For lettering, you would need to figure out
how to increment the letter. but for simple numbered lists, this might do
the trick for you.

#+BEGIN_SRC emacs-lisp
(defun auto-continue ()
  (interactive)
  (when-let (p (org-in-item-p))
    (save-excursion
      (goto-char (line-end-position))
      (goto-char (org-element-property :contents-begin
(org-element-context)))
      (let* ((lists (org-element-map (org-element-parse-buffer) 'plain-list
     (lambda (lst)
(when (eq 'ordered (org-element-property :type lst))
 (cons
  (org-element-property :end lst)
  (length (org-element-property :structure lst)))))))
    (last-list (nth (- (or (-find-index (lambda (x)
  (> (car x) (point)))
lists)
   (length lists))
1)
    lists)))
(insert (format "[@%s] " (+ 1 (cdr last-list))))
(org-ctrl-c-ctrl-c)))))

#+END_SRC


John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Sat, Nov 2, 2019 at 5:49 AM Jarmo Hurri <jarmo.hurri@iki.fi> wrote:

>
> Greetings.
>
> I know that lists can be continued using the following syntax:
>
> # -----------------------------------------------------------
> * First heading
>   1. a list begins here
> * Second heading
>   2. [@2] list continues
> # -----------------------------------------------------------
>
> I find myself doing this all the time, especially when working on Beamer
> slides.
>
> Given how smart org mode is (it is!), I find manual list continuation
> weird. My questions are:
>
> a. Is there already a better way?
> b. [@b] Could we have one?
>
> Jarmo
>
>
>

[-- Attachment #2: Type: text/html, Size: 2788 bytes --]

  reply	other threads:[~2019-11-02 17:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-02  9:34 Continued lists Jarmo Hurri
2019-11-02 17:20 ` John Kitchin [this message]
2019-11-02 19:01 ` Samuel Wales
2019-11-03 13:33 ` Fraga, Eric

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='CAJ51ETrU5LsnEMPUAduxP9qLOepVn=01is_-tktqy+wH5UdrWg@mail.gmail.com' \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=jarmo.hurri@iki.fi \
    /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).