From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: Re: [PATCH] Skip source block fontification when the language is not defined Date: Wed, 22 Dec 2010 12:34:59 -0500 Message-ID: <878vzhyam4.fsf@norang.ca> 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=44879 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PVSae-0001DP-6T for emacs-orgmode@gnu.org; Wed, 22 Dec 2010 12:35:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PVSac-000069-PH for emacs-orgmode@gnu.org; Wed, 22 Dec 2010 12:35:04 -0500 Received: from mho-01-ewr.mailhop.org ([204.13.248.71]:38827) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PVSac-00005h-Lb for emacs-orgmode@gnu.org; Wed, 22 Dec 2010 12:35:02 -0500 In-Reply-To: (Dan Davison's message of "Wed, 22 Dec 2010 15:11:37 +0000") 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: Dan Davison Cc: emacs-orgmode@gnu.org Dan Davison writes: > Bernt Hansen writes: > >> 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 ,----[ messages buffer ] | Fontifying org-src-fontification:emacs-lisp-mode... (regexps.....................) | if: Unrecognised language: line: 1210 | Ispell process killed | Starting new Ispell process [british] ... `---- This chokes on the #+end_example line of this block: ,---- | | *Clock history selection buffer for C-u C-c C-x C-i* | #+begin_example | Default Task | [d] norang Organization <-- Task B | The task interrupted by starting the last one | [i] norang Organization <-- Task B | Current Clocking Task | [c] org NEXT Document my use of org-mode <-- Task A | Recent Tasks | [1] org NEXT Document my use of org-mode <-- Task A | [2] norang Organization <-- Task B | ... | [Z] org DONE Fix default section links <-- 35 clock task entries ago | #+end_example `---- The last line '#+end_example' is line 1210. Huh? -Bernt