From: <tomas@tuxteam.de>
To: Arthur Miller <arthur.miller@live.com>
Cc: Tom Gillespie <tgbugs@gmail.com>, emacs-devel@gnu.org
Subject: Re: Font lock in org+elisp confused with ?\[
Date: Thu, 1 Apr 2021 11:04:11 +0200 [thread overview]
Message-ID: <20210401090411.GB16534@tuxteam.de> (raw)
In-Reply-To: <AM9PR09MB49775ECEF64142097940ED4D967B9@AM9PR09MB4977.eurprd09.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 1646 bytes --]
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)))
...
(with-current-buffer
(get-buffer-create
(format " *org-src-fontification:%s*" lang-mode))
...))
The rest is left to the reader's fantasy, as they say :)
Cheers
- t
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2021-04-01 9:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 5:43 Font lock in org+elisp confused with ?\[ Tom Gillespie
2021-04-01 7:18 ` Arthur Miller
2021-04-01 9:04 ` tomas [this message]
2021-04-01 15:44 ` Arthur Miller
-- strict thread matches above, loose matches on Subject: below --
2021-04-01 4:42 Arthur Miller
2021-04-02 4:23 ` Tim Cross
2021-04-02 13:03 ` John Kitchin
2021-04-02 22:59 ` Tom Gillespie
2021-04-03 18:38 ` Arthur Miller
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210401090411.GB16534@tuxteam.de \
--to=tomas@tuxteam.de \
--cc=arthur.miller@live.com \
--cc=emacs-devel@gnu.org \
--cc=tgbugs@gmail.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).