all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Charles C. Berry" <ccberry@ucsd.edu>
To: emacs-orgmode@gnu.org
Subject: [PATCH} Re: Bug: problem when exporting a org-mode file with a lots of code	blocks
Date: Tue, 10 Mar 2015 14:22:51 -0700	[thread overview]
Message-ID: <alpine.OSX.2.00.1503101411500.2030@charlessmacbook> (raw)
In-Reply-To: <loom.20150310T175806-192@post.gmane.org>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1305 bytes --]


The patch causes an informative error message to be reported for src 
blocks like this (no language):

#+begin_src
(+ 1 2)
#_end_src

when exporting instead of failing with a cryptic error message.

Arguably, it would be better to skip the malformed src block as 
`org-babel-map-src-blocks' does or (as per John's message) 
org-babel-tangle does.

WDYT?

Chuck


On Tue, 10 Mar 2015, Charles Berry wrote:

> XIE Yuheng <xyheme <at> gmail.com> writes:
>
>>
>>
>> Bug: org-babel-parse-src-block-match reporting "Wrong type argument:
>> stringp, nil" when exporting a org-mode file with a lots of code blocks
>> [8.3beta (release_8.3beta-895-g375c83  <at>
>> /usr/share/emacs/site-lisp/org/)]
>>
>> the following is *Messages* buffer
>>    https://www.refheap.com/98243
>> the following is the org-mode file with a lot of code blocks
>>    https://github.com/the-little-language-designer/cicada-nymph/blob/
> master/cicada-nymph.org
>
>
> Look at the *Messages*  buffer and you will see a list of src blocks that were
> processed without error.
>
> The src block *after* the last block in the list (before the error message)
> caused the error.
>
> `org-babel-parse-src-block-match' expects a language for a src block.
>
> Specify a language for every src block and it will export.
>
> HTH,
>
> Chuck
>
>
>

[-- Attachment #2: Better error for bad src block --]
[-- Type: TEXT/PLAIN, Size: 1333 bytes --]

From f9859c09c5ad4790ef94d87477e7dfb97f264880 Mon Sep 17 00:00:00 2001
From: Charles Berry <ccberry@ucsd.edu>
Date: Tue, 10 Mar 2015 14:09:52 -0700
Subject: [PATCH] ob-exp.el: org-babel-exp-process-buffer reports src block w/o
 language

* lisp/ob-exp.el (org-babel-exp-process-buffer): Issue an error when a
  src block with neither language nor headers is processed.

Throw an error with an informative message when trying to export buffer
containing `#+src_block\n'.

Reported-by: XIE Yuheng <xyheme@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/95920>
---
 lisp/ob-exp.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index 4c53a55..d17e49f 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -268,7 +268,11 @@ may make them unreachable."
 		   ;; the block should be left as-is while an empty
 		   ;; string should remove the block.
 		   (let ((replacement
-			  (progn (goto-char match-start)
+			  (progn (when (null (car headers))
+				   (error
+				    "No src block language or headers at line %S"
+				    (line-number-at-pos)))
+				 (goto-char match-start)
 				 (org-babel-exp-src-block headers))))
 		     (cond ((not replacement) (goto-char end))
 			   ((equal replacement "")
-- 
1.9.3 (Apple Git-50)


  reply	other threads:[~2015-03-10 21:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10  7:37 Bug: problem when exporting a org-mode file with a lots of code blocks XIE Yuheng
2015-03-10 16:51 ` John Kitchin
2015-03-10 17:19 ` Charles Berry
2015-03-10 21:22   ` Charles C. Berry [this message]
2015-03-11  7:40     ` [PATCH} " Nicolas Goaziou
2015-03-11 11:16       ` Nicolas Goaziou
2015-03-12  2:30         ` Charles C. Berry
2015-03-13  8:12           ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.OSX.2.00.1503101411500.2030@charlessmacbook \
    --to=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.