emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Re: [BUG] nested blocks aren't protected on export


From: Carsten Dominik
Subject: Re: [Orgmode] Re: [BUG] nested blocks aren't protected on export
Date: Tue, 29 Jun 2010 06:32:03 +0200

Hi Eric,

On Jun 28, 2010, at 9:59 PM, Eric Schulte wrote:

Carsten Dominik <address@hidden> writes:

[...]

For now I don't see anything wrong with this.  The fastest
way to find out is to put it into master and watch the list :-)
Please go ahead and do that.


I think this patch may have uncovered a bug in the export preprocessing which was previously being covered up by the over-eager comment pruning.

I've now got another patch [1] which fixes the bug in
`org-export-mark-blockquote-verse-center' which was leaving # +end_quote
lines littered in the pre-processed files.

If this looks good to you please do apply it, I'll run it locally in the
meantime to see if any unexpected behavior develops.

Thanks -- Eric


Thanks.

- Carsten

Footnotes:
[1] From 251647d34f599dd025bb08376c0a3eabac604c9d Mon Sep 17 00:00:00 2001
From: Eric Schulte <address@hidden>
Date: Mon, 28 Jun 2010 12:52:44 -0700
Subject: [PATCH] org-exp: ensure that #+end_quote lines are removed

* lisp/org-exp.el (org-export-mark-blockquote-verse-center): ensure
 that the end_quote line is removed during buffer preprocessing
---
lisp/org-exp.el |    3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index f0c11d6..1cd8fc2 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1569,7 +1569,8 @@ These special cookies will later be interpreted by the backend."
            beg1 (1+ (match-end 0)))
(when (re-search-forward (concat "^[ \t]*#\\+end_" type "\ \>.*") nil t)
        (setq end (+ (point-at-eol) (if (looking-at "\n$") 1 0))
-             end1 (1- (match-beginning 0)))
+             end1 (save-excursion (goto-char (1- (match-beginning 0)))
+                                  (point-at-bol)))
        (setq content (org-remove-indentation (buffer-substring beg1 end1)))
        (setq content (concat "ORG-" (upcase t1) "-START\n"
                              content "\n"
--
1.7.0.4

I think the better fix woud be

diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index f0c11d6..23fb07b 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1568,8 +1568,8 @@ These special cookies will later be interpreted by the bac
       (setq beg (match-beginning 0)
            beg1 (1+ (match-end 0)))
(when (re-search-forward (concat "^[ \t]*#\\+end_" type "\ \>.*") nil t)
-       (setq end (+ (point-at-eol) (if (looking-at "\n$") 1 0))
-             end1 (1- (match-beginning 0)))
+       (setq end1 (1- (match-beginning 0))
+             end (+ (point-at-eol) (if (looking-at "\n$") 1 0)))
(setq content (org-remove-indentation (buffer-substring beg1 end1)))
        (setq content (concat "ORG-" (upcase t1) "-START\n"
                              content "\n"


The reason why this fails seems to be because of the looking-at.
When this code was first written, (match-beginning 0) referred to
the earlier regexp match, but the looking-at, if it matches,
changes the meaning of that form.

Could you please try if my patch works as well, and if yes apply it?

Thanks.

- Carsten





- Carsten






reply via email to

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