emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Flymake support for C/C++


From: Stefan Monnier
Subject: Re: [PATCH] Flymake support for C/C++
Date: Thu, 12 Oct 2017 17:03:10 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> > What is stopping the needed setup and initialisation being in a
>> > function to be added to one of the mode's hooks: say c-mode-common-hook,
>> > or even c-initialization-hook (which are documented in the CC Mode
>> > manual)?
>> The same could apply to font-lock support in CC-mode, or indentation
>> support in CC-mode, or imenu support, or ...
> Font-lock and indentation support are essential to the major mode.  But
> all of these, bar indentation, are connected to major modes via hooks of
> one sort or another.

AFAICT, imenu support in CC-mode is enabled by having the major mode
function explicitly calling cc-imenu-init, not via some kind of hook.

Maybe all you want is for flymake support to be moved to cc-flymake.el
and then calls to `cc-flymake-init` be added to the relevant major
mode functions?

>> I'm not saying that the flymake support for C code has to be in CC-mode,
>> but I think it's a natural place for it.
> What does Flymake mode do, anyway?

It runs a code-checker in the background and highlights the source code
with the various error/warnings found.  It's very much like flyspell
except design to check code sanity rather spelling.

I think nowadays Emacs should strive to enable flymake automatically as
much as possible.  It's currently not really possible because *very* few
major modes support it, and because for most major modes you can't get
it to work without some user intervention (typically we need to have
some knowledge of the overall project organization in order to know how
this file relates to others, in C code typically we need at least
information about -I and -D compilation options).

But for Emacs-27, we should at the very least aim to enable it in
emacs-lisp-mode (where checking can be done without needing extra user
intervention).

> There's no documentation for it in the Emacs manual,

It's definitely in the manual in the emacs-26 branch.


        Stefan



reply via email to

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