emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] babel: delaying call to block preprocessing
@ 2010-11-12  2:15 Nicolas Goaziou
  2010-11-12 23:44 ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Goaziou @ 2010-11-12  2:15 UTC (permalink / raw)
  To: Org Mode List

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

Hello,

I'm having a little problem when I want to insert a code block inside
a list. Here is an example:

=====
1. Drawing is following:
   
   #+BEGIN_SRC asymptote :file drawing.pdf
   unitsize(5cm);
   draw(unitcircle);
   #+END_SRC

   Now find its center with compass only.

2. Another item.
=====

Upon exporting this, as the code is removed, the blank lines
surrounding it join together, creating a 2-blank-lines combo very bad
for the list processing taking place a few lines later. Indeed, when
`org-export-preprocess-string' proceeds marking list endings in the
export string, it sees there two separates lists instead of one.

So, the following patch moves `org-export-blocks-preprocess' out of
its hook (now babel is in Org core this isn't needed anymore), and
make it called somewhat later, after list processing (and after
removing excluded and archived trees).

Regards,

--
Nicolas


[-- Attachment #2: 0001-babel-delay-call-to-org-export-blocks-preprocess-in-.patch --]
[-- Type: text/plain, Size: 1476 bytes --]

From f280a3ef4c8bc54eb0a299a66d42a4ac47622730 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Fri, 12 Nov 2010 03:08:09 +0100
Subject: [PATCH] babel: delay call to `org-export-blocks-preprocess' in export

* lisp/org-exp.el (org-export-preprocess-string): delaying code block
  processing a bit to allow correct list parsing in the export string
---
 lisp/org-exp-blocks.el |    3 ---
 lisp/org-exp.el        |    3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/org-exp-blocks.el b/lisp/org-exp-blocks.el
index 3751e68..a469afc 100644
--- a/lisp/org-exp-blocks.el
+++ b/lisp/org-exp-blocks.el
@@ -201,9 +201,6 @@ which defaults to the value of `org-export-blocks-witheld'."
 	(interblock start (point-max))
 	(run-hooks 'org-export-blocks-postblock-hook)))))
 
-(add-hook 'org-export-preprocess-after-include-files-hook
-	  'org-export-blocks-preprocess)
-
 ;;================================================================================
 ;; type specific functions
 
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 9004dd5..820c179 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1080,6 +1080,9 @@ on this string to produce the exported version."
       ;; Mark end of lists
       (org-export-mark-list-ending backend)
 
+      ;; Export code blocks
+      (org-export-blocks-preprocess)
+
       ;; Handle source code snippets
       (org-export-replace-src-segments-and-examples backend)
 
-- 
1.7.3.2


[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [PATCH] babel: delaying call to block preprocessing
  2010-11-12  2:15 [PATCH] babel: delaying call to block preprocessing Nicolas Goaziou
@ 2010-11-12 23:44 ` Eric Schulte
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2010-11-12 23:44 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode List

Hi Nicolas,

Thanks for making this change, I agree it is appropriate now that Babel
is included in Org-mode.  I've just pushed it up.

Best -- Eric

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

> Hello,
>
> I'm having a little problem when I want to insert a code block inside
> a list. Here is an example:
>
> =====
> 1. Drawing is following:
>    
>    #+BEGIN_SRC asymptote :file drawing.pdf
>    unitsize(5cm);
>    draw(unitcircle);
>    #+END_SRC
>
>
>    Now find its center with compass only.
>
> 2. Another item.
> =====
>
> Upon exporting this, as the code is removed, the blank lines
> surrounding it join together, creating a 2-blank-lines combo very bad
> for the list processing taking place a few lines later. Indeed, when
> `org-export-preprocess-string' proceeds marking list endings in the
> export string, it sees there two separates lists instead of one.
>
> So, the following patch moves `org-export-blocks-preprocess' out of
> its hook (now babel is in Org core this isn't needed anymore), and
> make it called somewhat later, after list processing (and after
> removing excluded and archived trees).
>
> Regards,
>
> --
> Nicolas
>

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

end of thread, other threads:[~2010-11-13  0:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-12  2:15 [PATCH] babel: delaying call to block preprocessing Nicolas Goaziou
2010-11-12 23:44 ` Eric Schulte

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