emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [RFC] Small syntax change for footnote definitions
@ 2013-02-21 14:45 Nicolas Goaziou
  2013-02-21 17:44 ` Aaron Ecay
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2013-02-21 14:45 UTC (permalink / raw)
  To: Org Mode List

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

Hello,

Following a thread started by Samuel Wales (see
http://permalink.gmane.org/gmane.emacs.orgmode/66558), it appears that
the standard way to include multiple paragraphs in a footnote definition
is to rely on "\par" LaTeXism.

There are two problems here. Firstly, the parser would have to go out of
its way to support this trick. Secondly, it isn't very regular wrt Org
syntax.

I suggest to end a footnote definition at a headline, another footnote
definition or *two* blank lines.

Pros:

  - Small modification to code base.
  - More regular syntax (lists use the same)

Cons:

  - Still impossible to have two consecutive lists (because they need
    to be separated by 2 blank lines).
  - Small incompatibility with previous syntax.


Is there any objection to apply this patch?


Regards,

-- 
Nicolas Goaziou

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: change syntax for footnote definitions --]
[-- Type: text/x-patch, Size: 2508 bytes --]

From 18a95bdc2667ea01a75a7b9ddaff55cd4ea5c329 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Thu, 21 Feb 2013 15:30:16 +0100
Subject: [PATCH] Require 2 blank lines to separate footnote definition

* lisp/org-element.el (org-element-footnote-definition-parser):
  Require 2 blank lines to separate footnote definition.
* lisp/org-footnote.el (org-footnote-at-definition-p): Require 2 blank
  lines to separate footnote definition.

Footnote definitions can still be separated with other footnote
definitions and headlines. This change allows to have multiple
paragraphs in a footnote definition.
---
 lisp/org-element.el  |  2 +-
 lisp/org-footnote.el | 13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index 3dc1e72..012aea7 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -693,7 +693,7 @@ Assume point is at the beginning of the footnote definition."
 			   (re-search-forward
 			    (concat org-outline-regexp-bol "\\|"
 				    org-footnote-definition-re "\\|"
-				    "^[ \t]*$") limit 'move))
+				    "\n\\([ \t]*\n\\)\\{2,\\}") limit 'move))
 			 (match-beginning 0)
 		       (point))))
 	   (contents-begin (progn (search-forward "]")
diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index 9aa388b..d99bdec 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -251,11 +251,12 @@ otherwise."
   (when (save-excursion (beginning-of-line) (org-footnote-in-valid-context-p))
     (save-excursion
       (end-of-line)
-      ;; Footnotes definitions are separated by new headlines or blank
-      ;; lines.
-      (let ((lim (save-excursion (re-search-backward
-				  (concat org-outline-regexp-bol
-					  "\\|^[ \t]*$") nil t))))
+      ;; Footnotes definitions are separated by new headlines, another
+      ;; footnote definition or 2 blank lines.
+      (let ((lim (save-excursion
+		   (re-search-backward
+		    (concat org-outline-regexp-bol
+			    "\\|\n\\([ \t]*\n\\)\\{2,\\}") nil t))))
 	(when (re-search-backward org-footnote-definition-re lim t)
 	  (let ((label (org-match-string-no-properties 1))
 		(beg (match-beginning 0))
@@ -271,7 +272,7 @@ otherwise."
 			     (re-search-forward
 			      (concat org-outline-regexp-bol "\\|"
 				      org-footnote-definition-re "\\|"
-				      "^[ \t]*$") bound 'move))
+				      "\n\\([ \t]*\n\\)\\{2,\\}") bound 'move))
 			   (match-beginning 0)
 			 (point)))))
 	    (list label beg end
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [RFC] Small syntax change for footnote definitions
  2013-02-21 14:45 [RFC] Small syntax change for footnote definitions Nicolas Goaziou
@ 2013-02-21 17:44 ` Aaron Ecay
  2013-02-21 17:51   ` Nicolas Goaziou
  2013-02-21 18:07 ` Samuel Wales
  2013-02-24 13:48 ` Nicolas Goaziou
  2 siblings, 1 reply; 6+ messages in thread
From: Aaron Ecay @ 2013-02-21 17:44 UTC (permalink / raw)
  To: Nicolas Goaziou, Org Mode List

Nicolas,

I don’t know how difficult this would be in terms of the code, but would
it be possible to introduce a new syntax for multiparagraph footnotes?
Something like:

#+begin_footnote 12
This is footnote number 12.

etc.
#+end_footnote

This has the advantage that long footnote definitions could be folded,
which (AFAIK) they currently cannot.  And it would not have the problem
with multiple lists.

Just a suggestion,

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] Small syntax change for footnote definitions
  2013-02-21 17:44 ` Aaron Ecay
@ 2013-02-21 17:51   ` Nicolas Goaziou
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2013-02-21 17:51 UTC (permalink / raw)
  To: Org Mode List

Aaron Ecay <aaronecay@gmail.com> writes:

> Nicolas,
>
> I don’t know how difficult this would be in terms of the code, but would
> it be possible to introduce a new syntax for multiparagraph footnotes?
> Something like:
>
> #+begin_footnote 12
> This is footnote number 12.
>
> etc.
> #+end_footnote
>
> This has the advantage that long footnote definitions could be folded,
> which (AFAIK) they currently cannot.  

They cannot be folded, but they can be collected in a specific headline,
which can be folded.

> And it would not have the problem with multiple lists.

Consecutive lists limitation is anecdotal, really. Also, this syntax
would break every footnote definition, unless you mean to add syntax
only for multiparagraph footnotes. But I think we don't have to go that
far.

My proposal doesn't really introduce some new syntax. It merely
normalizes a corner-case.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] Small syntax change for footnote definitions
  2013-02-21 14:45 [RFC] Small syntax change for footnote definitions Nicolas Goaziou
  2013-02-21 17:44 ` Aaron Ecay
@ 2013-02-21 18:07 ` Samuel Wales
  2013-02-21 18:43   ` Nicolas Goaziou
  2013-02-24 13:48 ` Nicolas Goaziou
  2 siblings, 1 reply; 6+ messages in thread
From: Samuel Wales @ 2013-02-21 18:07 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode List

Thank you for asking the list.

Does this allow blank lines to separate paragraphs in inline footnote
definitions?

If so, it sounds very good.

I presume we can still do

===
  1) a

b.

  1) c
===

On 2/21/13, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> I suggest to end a footnote definition at a headline, another footnote
> definition or *two* blank lines.

Samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY
can get it.  There is no hope without action.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] Small syntax change for footnote definitions
  2013-02-21 18:07 ` Samuel Wales
@ 2013-02-21 18:43   ` Nicolas Goaziou
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2013-02-21 18:43 UTC (permalink / raw)
  To: Samuel Wales; +Cc: Org Mode List

Samuel Wales <samologist@gmail.com> writes:

> Does this allow blank lines to separate paragraphs in inline footnote
> definitions?

No. Inline definitions stay inlined and as such, cannot contain blank
lines. My proposal is only about full footnote definitions.

> If so, it sounds very good.
>
> I presume we can still do
>
> ===
>   1) a
>
> b.
>
>   1) c
> ===

Yes, the limitation is only about two consecutive lists. In this case,
they are not consecutive.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] Small syntax change for footnote definitions
  2013-02-21 14:45 [RFC] Small syntax change for footnote definitions Nicolas Goaziou
  2013-02-21 17:44 ` Aaron Ecay
  2013-02-21 18:07 ` Samuel Wales
@ 2013-02-24 13:48 ` Nicolas Goaziou
  2 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2013-02-24 13:48 UTC (permalink / raw)
  To: Org Mode List

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Following a thread started by Samuel Wales (see
> http://permalink.gmane.org/gmane.emacs.orgmode/66558), it appears that
> the standard way to include multiple paragraphs in a footnote definition
> is to rely on "\par" LaTeXism.
>
> There are two problems here. Firstly, the parser would have to go out of
> its way to support this trick. Secondly, it isn't very regular wrt Org
> syntax.
>
> I suggest to end a footnote definition at a headline, another footnote
> definition or *two* blank lines.

Patch applied.

As a reminder, it only requires some change if:

  1. you used "\par" in the footnote definition: now you can replace it
     with a single blank line.

  2. you need regular text (i.e. not a headline or another footnote
     definition) after the definition: separate definition and text with
     two empty lines.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-02-24 13:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-21 14:45 [RFC] Small syntax change for footnote definitions Nicolas Goaziou
2013-02-21 17:44 ` Aaron Ecay
2013-02-21 17:51   ` Nicolas Goaziou
2013-02-21 18:07 ` Samuel Wales
2013-02-21 18:43   ` Nicolas Goaziou
2013-02-24 13:48 ` Nicolas Goaziou

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).