From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: [RFC] Small syntax change for footnote definitions Date: Thu, 21 Feb 2013 15:45:28 +0100 Message-ID: <8738wp3euv.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:45843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8XPG-0006rq-IZ for emacs-orgmode@gnu.org; Thu, 21 Feb 2013 09:46:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8XP6-0004Bj-LE for emacs-orgmode@gnu.org; Thu, 21 Feb 2013 09:45:54 -0500 Received: from mail-wi0-f178.google.com ([209.85.212.178]:60214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8XP6-0004BR-AC for emacs-orgmode@gnu.org; Thu, 21 Feb 2013 09:45:44 -0500 Received: by mail-wi0-f178.google.com with SMTP id o1so7658629wic.11 for ; Thu, 21 Feb 2013 06:45:43 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode List --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Require-2-blank-lines-to-separate-footnote-definitio.patch Content-Description: change syntax for footnote definitions >From 18a95bdc2667ea01a75a7b9ddaff55cd4ea5c329 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou 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 --=-=-=--