help-gnu-emacs
[Top][All Lists]
Advanced

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

advice after fontify region with c-mode


From: Filippo Argiolas
Subject: advice after fontify region with c-mode
Date: Thu, 14 Sep 2023 22:30:05 +0200

Hi,

with [1] I'd like to run a function after fontification is completed.

At the moment I'm doing something like this:
         (add-function :after (local 'font-lock-fontify-region-function)
                       #'my-fontify-region-function))

This runs in a hook for eglot-managed-hook.

While this works pretty well with c-ts-mode I'm having some issues
with c-mode because they have a custom fontification function that
extends the region to fontify before funcalling the default fontify
region function.

Relevant code in cc-mode.el is:
- at init
  (make-local-variable 'font-lock-fontify-region-function)
  (setq font-lock-fontify-region-function 'c-font-lock-fontify-region)

- at the end of c-font-lock-fontify-region
     (funcall (default-value 'font-lock-fontify-region-function)
          new-beg new-end verbose)

Problem is my function gets called after c-font-lock-fontify (as I
wanted) but with the original beg end values instead of the extended
new-beg and new-end values.

What am I missing? Any suggestions?

Thanks,
Filippo


1. https://github.com/fargiolas/clangd-inactive-regions



reply via email to

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