From: "Eric Schulte" <schulte.eric@gmail.com>
To: "Thomas S. Dye" <tsd@tsdye.com>
Cc: Emacs-orgmode mailing list <emacs-orgmode@gnu.org>
Subject: Re: [BUG] #+begin_src wo. language blocks XHTML export
Date: Fri, 09 Jul 2010 21:32:28 -0700 [thread overview]
Message-ID: <871vbcgdnn.fsf@gmail.com> (raw)
In-Reply-To: <8BFEB2A8-C320-475C-861D-6FDF1F74AB50@tsdye.com> (Thomas S. Dye's message of "Thu, 8 Jul 2010 09:37:57 -1000")
[-- Attachment #1: Type: text/plain, Size: 985 bytes --]
"Thomas S. Dye" <tsd@tsdye.com> writes:
> On Jul 8, 2010, at 9:09 AM, Eric Schulte wrote:
>
>> Sebastian Rose <sebastian_rose@gmx.de> writes:
>>
>> [...]
>>>
>>> It can be considered an error, since the docs say:
>>>
>>> "...This is done with the ‘src’ block, where you also need to
>>> specify the name of the major mode that should be used to fontify
>>> the example..."
>>>
>>
>> I would vote that this be considered an error as a source block
>> doesn't make sense w/o a source language. If others agree with this
>> interpretation, I would be happy to submit a patch which actively
>> raises an errors when this cases is encountered.
>>
>> Cheers -- Eric
>
> This seems like the right approach to me.
>
> Tom
As promised here's a patch which raises errors when source blocks don't
have a specified language. I would prefer if the error could indicate
which block caused the problem, but I don't know how to accomplish this.
Best -- Eric
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: error-on-missing-lang.patch --]
[-- Type: text/x-diff, Size: 1687 bytes --]
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 80f6e11..a680339 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -2107,19 +2107,21 @@ in the list) and remove property and value from the list in LISTVAR."
lang code trans opts indent caption)
(goto-char (point-min))
(while (re-search-forward
- "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\n?\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\n?\\)"
+ "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?\\([ \t]+\\([^ \t\n]+\\)\\)?\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\n?\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\n?\\)"
nil t)
(if (match-end 1)
- ;; src segments
- (setq lang (match-string 3)
- opts (match-string 4)
- code (match-string 5)
- indent (length (match-string 2))
- caption (get-text-property 0 'org-caption (match-string 0)))
+ (if (not (match-string 4))
+ (error "source block missing language specification")
+ ;; src segments
+ (setq lang (match-string 4)
+ opts (match-string 5)
+ code (match-string 6)
+ indent (length (match-string 2))
+ caption (get-text-property 0 'org-caption (match-string 0))))
(setq lang nil
- opts (match-string 8)
- code (match-string 9)
- indent (length (match-string 7))
+ opts (match-string 9)
+ code (match-string 10)
+ indent (length (match-string 8))
caption (get-text-property 0 'org-caption (match-string 0))))
(setq trans (org-export-format-source-code-or-example
[-- 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
next prev parent reply other threads:[~2010-07-10 4:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-25 23:02 [BUG] #+begin_src wo. language blocks XHTML export Sebastian Rose
2010-07-04 14:11 ` David Maus
2010-07-04 22:10 ` Sebastian Rose
2010-07-05 14:56 ` David Maus
2010-07-08 19:09 ` Eric Schulte
2010-07-08 19:37 ` Thomas S. Dye
2010-07-10 4:32 ` Eric Schulte [this message]
2010-07-12 8:13 ` David Maus
2010-07-12 9:11 ` Carsten Dominik
2010-07-12 17:44 ` Eric Schulte
2010-07-12 18:12 ` Carsten Dominik
2010-07-12 19:33 ` Eric Schulte
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=871vbcgdnn.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=tsd@tsdye.com \
/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.