* Continued lists
@ 2019-11-02 9:34 Jarmo Hurri
2019-11-02 17:20 ` John Kitchin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jarmo Hurri @ 2019-11-02 9:34 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Continued lists
2019-11-02 9:34 Continued lists Jarmo Hurri
@ 2019-11-02 17:20 ` John Kitchin
2019-11-02 19:01 ` Samuel Wales
2019-11-03 13:33 ` Fraga, Eric
2 siblings, 0 replies; 4+ messages in thread
From: John Kitchin @ 2019-11-02 17:20 UTC (permalink / raw)
To: Jarmo Hurri; +Cc: org-mode-email
[-- 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 --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Continued lists
2019-11-02 9:34 Continued lists Jarmo Hurri
2019-11-02 17:20 ` John Kitchin
@ 2019-11-02 19:01 ` Samuel Wales
2019-11-03 13:33 ` Fraga, Eric
2 siblings, 0 replies; 4+ messages in thread
From: Samuel Wales @ 2019-11-02 19:01 UTC (permalink / raw)
To: Jarmo Hurri; +Cc: emacs-orgmode
continuing one after prev list is a great idea. then you won't get
out of sync. dunno if feasible.
--
The Kafka Pandemic
What is misopathy?
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html
The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Continued lists
2019-11-02 9:34 Continued lists Jarmo Hurri
2019-11-02 17:20 ` John Kitchin
2019-11-02 19:01 ` Samuel Wales
@ 2019-11-03 13:33 ` Fraga, Eric
2 siblings, 0 replies; 4+ messages in thread
From: Fraga, Eric @ 2019-11-03 13:33 UTC (permalink / raw)
To: Jarmo Hurri; +Cc: emacs-orgmode@gnu.org
Jarmo,
John has already given you some elisp code that can help. The other
possibility could be to use the counter macro.
See the info manual: (org) Macro Replacement
--
Eric S Fraga via Emacs 27.0.50, Org release_9.2.6-552-g8c5a78
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-11-03 13:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-02 9:34 Continued lists Jarmo Hurri
2019-11-02 17:20 ` John Kitchin
2019-11-02 19:01 ` Samuel Wales
2019-11-03 13:33 ` Fraga, Eric
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).