emacs-devel
[Top][All Lists]
Advanced

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

Re: cc-mode fontification feels random


From: Stephen Leake
Subject: Re: cc-mode fontification feels random
Date: Sun, 11 Jul 2021 11:12:04 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt)

Daniel Colascione <dancol@dancol.org> writes:

> ...  cc-mode is still very inconsistent in
> fontification though. Take a look at the attached screenshot, which is
> of this program:
>
> void
> deallocate_one_arg(void* const ptr_to_arg,
>                    MethodProgramPc& pc);
>
> void
> deallocate_one_arg(void* const ptr_to_arg,
>                    MethodProgramPc& pc);
>
> I'm confused about why "MethodProgramPc" is fontified as a type in the
> first prototype but not the second. I still wish we had a
> general-purpose mechanism for ensuring that problems like this didn't
> happen.

The ELPA package wisi provides a parser-based fontification engine,
which makes things like this more consistent. It is currently used for
ada-mode. Note that syntax errors in the source can cause bad
fontification, but the wisi parser has very robust error-correction, so
it usually does a good job even with syntax errors.

However, parsing C and C++ is complicated by macros; wisi makes no
provision for that.

Another option is an LSP based system via the EPLA package eglot; that
delegates fontification to the language server. I don't know how well
the C/C++ language servers perform for this.

-- 
-- Stephe



reply via email to

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