Eglot was the first request cited. For python programmers that rely on per project/directory-local or per-buffer virtual environment set up, this can be heavier than needed just for fontification. I enable eglot manually, but I do use python virtual environments and would disable initialization in fontification buffers.

I'd prefer a more generic interface than propagating org internals like the format of the fortification buffer name. It's what I submitted to the markdown repo also. The buffer name scheme can change in the future without impacting this feature.

-Stephane

On Sat, Jan 18, 2025 at 2:27 AM Ihor Radchenko <yantar92@posteo.net> wrote:
Ship Mints <shipmints@gmail.com> writes:

> I've added the predicate function org-src-is-fontify-buffer-p which can be
> used in a prog-mode hook to avoid resource-intensive features such as eglot
> inside a fontification buffer. This short example should make it clear.
>
> (defun my/emacs-lisp-hook ()
>   (unless (and (featurep 'org) (org-src-is-fontify-buffer-p))
>     (eglot-ensure)))

Thanks!

Do you have other examples where the new predicate could be useful apart
from eglot? For eglot specifically, one can do a much simpler test -
check for `buffer-file-name'.

--
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>