From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: [PATCH] Skip source block fontification when the language is not defined Date: Wed, 22 Dec 2010 15:11:37 +0000 Message-ID: References: <87r5da1mvr.fsf@norang.ca> <1292990777-10733-1-git-send-email-bernt@norang.ca> <87r5d9ykob.fsf@norang.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=57452 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PVQMA-0004Z7-T7 for emacs-orgmode@gnu.org; Wed, 22 Dec 2010 10:11:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PVQM8-00025r-KZ for emacs-orgmode@gnu.org; Wed, 22 Dec 2010 10:11:58 -0500 Received: from lo.gmane.org ([80.91.229.12]:46607) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PVQM8-00025g-8v for emacs-orgmode@gnu.org; Wed, 22 Dec 2010 10:11:56 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PVQM4-0002GW-6Q for emacs-orgmode@gnu.org; Wed, 22 Dec 2010 16:11:52 +0100 Received: from 94.197.185.4.threembb.co.uk ([94.197.185.4]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 22 Dec 2010 16:11:52 +0100 Received: from dandavison7 by 94.197.185.4.threembb.co.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 22 Dec 2010 16:11:52 +0100 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: emacs-orgmode@gnu.org Bernt Hansen writes: > Dan Davison writes: > >> Bernt Hansen writes: >> >>> * lisp/org.el: Skip source block fontification during export when language >>> is not defined >>> --- >>> This may not be the correct fix for this issue but it works for me. >> >> Hi Bernt, >> >> I've checked in a slightly different version[1] of this fix. Thanks for >> the report; it wasn't nice to have been throwing errors every time an >> unrecognised (e.g. partial) language string was entered, even if most of >> the time font-lock was subduing these errors. >> >> Dan >> >> Footnotes: >> [1] I've made the org-src fontification function test, early on, whether >> the language major-mode function exists. If it doesn't then it returns >> immediately. > > Thanks Dan, > > Your fix works for me :). > > I'm confused about _why_ I'm getting these errors though - I was > expecting fontification only to apply to #+begin_src blocks and I'm only > using a few languages in that document (sh, org, emacs-lisp, ditaa, and dot). > > Unless it's picking up on the begin_src in the following text Hi Bernt, I was wondering about the same thing. How about hacking the org-src-font-lock-fontify-block function so that it throws an error with a helpful message when the language string is unrecognised? I just tried this on your document with C-c C-e h and it didn't throw anything, but maybe in your setup it will? (Check the *Messages* buffer, it may be that font-lock handles the error). I've prepended the below with "$ " to stop patchwork from grabbing it. $ diff --git a/lisp/org-src.el b/lisp/org-src.el $ index f55e292..0d796b4 100644 $ --- a/lisp/org-src.el $ +++ b/lisp/org-src.el $ @@ -781,7 +781,9 @@ fontification of code blocks see `org-src-fontify-block' and $ (add-text-properties $ start end $ '(font-lock-fontified t fontified t font-lock-multiline t)) $ - (set-buffer-modified-p modified))))) $ + (set-buffer-modified-p modified)) $ + (error "Unrecognised language: %s line: %d" $ + lang (line-number-at-pos (point)))))) Dan > > ,---- > | I use this to create =#+begin_*= blocks like > | - =#+begin_example= > | - =#+begin_ditaa= > | - =#+begin_dot= > | - =#+begin_src= > | - etc. > `---- > > I wasn't able to determine the source line of the problem from the stack > dump information. Is there any way to determine what part of the > document is causing this (other than manually bisecting and exporting > with missing sections) ? > > Regards, > Bernt > > _______________________________________________ > 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