From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [BUG] #+begin_src wo. language blocks XHTML export Date: Fri, 09 Jul 2010 21:32:28 -0700 Message-ID: <871vbcgdnn.fsf@gmail.com> References: <87fx0abtr1.fsf@gmx.de> <87mxu7nxoy.wl%dmaus@ictsoc.de> <87iq4uzynf.fsf@gmx.de> <87r5jdsscu.fsf@gmail.com> <8BFEB2A8-C320-475C-861D-6FDF1F74AB50@tsdye.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=60064 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OXRju-0002u3-Ra for emacs-orgmode@gnu.org; Sat, 10 Jul 2010 00:32:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OXRjt-0006qF-5I for emacs-orgmode@gnu.org; Sat, 10 Jul 2010 00:32:34 -0400 Received: from mail-pz0-f41.google.com ([209.85.210.41]:50243) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OXRjs-0006q5-UG for emacs-orgmode@gnu.org; Sat, 10 Jul 2010 00:32:33 -0400 Received: by pzk33 with SMTP id 33so1485069pzk.0 for ; Fri, 09 Jul 2010 21:32:31 -0700 (PDT) In-Reply-To: <8BFEB2A8-C320-475C-861D-6FDF1F74AB50@tsdye.com> (Thomas S. Dye's message of "Thu, 8 Jul 2010 09:37:57 -1000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Thomas S. Dye" Cc: Emacs-orgmode mailing list --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable "Thomas S. Dye" writes: > On Jul 8, 2010, at 9:09 AM, Eric Schulte wrote: > >> Sebastian Rose writes: >> >> [...] >>> >>> It can be considered an error, since the docs say: >>> >>> "...This is done with the =E2=80=98src=E2=80=99 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=error-on-missing-lang.patch 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 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=--