[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Font lock in org+elisp confused with ?\[

From: tomas
Subject: Re: Font lock in org+elisp confused with ?\[
Date: Thu, 1 Apr 2021 11:04:11 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Apr 01, 2021 at 09:18:30AM +0200, Arthur Miller wrote:
> Tom Gillespie <tgbugs@gmail.com> writes:
> > This is a known issue with org babel blocks. It is due to the fact
> > that org babel translates the font locking for the language but not
> > the syntax propertization. Another frequent cause is the bash case
> > statement. The end result is that unmatched parens leak out from the
> > babel blocks and wreak havoc elsewhere in the org file unless you
> > balance out the parens e.g. in a comment. I have a hacked fix for
> > this, but it has horrible performance, especially with line numbers
> > enabled. I think that a proper solution would run arbitrary syntax
> > propertization on subsets of a buffer without having to continually
> > check where those subsets start or end. Best,
> > Tom
> Thanks for the explanation!
> I don't know how org-babel works, I guess it opens another buffer,
> font-locks syntax there and copy it over? What was the reason why they
> don't copy other properties? Performance or something else?

Hm. I've just poked around a bit. If you are talking about babel
blocks, I think the entry point is `org-src-font-lock-fontify-block',
defined in `org-src.el'.

And indeed, this function basically does this (with a lot of
corner-case chasing around, as is usual in our trade):

  (let ((lang-mode (org-src-get-lang-mode lang)))
               (format " *org-src-fontification:%s*" lang-mode))

The rest is left to the reader's fantasy, as they say :)

 - t

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]