emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Continued lists


From: John Kitchin
Subject: Re: Continued lists
Date: Sat, 2 Nov 2019 13:20:26 -0400

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


On Sat, Nov 2, 2019 at 5:49 AM Jarmo Hurri <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]