[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Flymake support for C/C++
From: |
João Távora |
Subject: |
Re: [PATCH] Flymake support for C/C++ |
Date: |
Thu, 12 Oct 2017 19:46:20 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) |
Hi Alan,
Thanks for the quick reply.
Alan Mackenzie <address@hidden> writes:
> I must admit not to being too keen on CC Mode changing like this; it
> would spoil the unity of purpose of the mode. I've glanced through the
> new code, but can't quite see why it needs to be an integral part of CC
> Mode.
Does setting a variable in the mode function make it an "integral part"?
> 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)?
I may be wrong, but I thought hooks were reserved for the user and
should be empty by default. But even if they weren't I don't think it
would work:
c-initialization-hook doesn't work, as flymake-diagnostic-functions is
a hook which needs a buffer-local value.
c-mode-common-hook is where a user would turn on `flymake-mode'. I, for
example, have this in my .emacs, which is the recommended way to turn on
a minor mode:
(add-hook 'c-mode-common-hook 'flymake-mode)
If the setup is also moved to c-mode-common-hook, then this won't work
(because flymake-mode activation comes before its setup).
> If there is any reason why it couldn't work on a CC Mode hook,
Absolutely no reason, but those two don't seem to fit. Perhaps some new
hook run before c-mode-common-hook.
> I'd far rather solve that reason (thus making the solution available
> for other libraries too, and pres<erving the unity of CC Mode).
I don't understand what the boundaries of that "unity" are, but I do
understand cc-mode.el seems to be a special citizen in Emacs
major-mode-land.
Anyway Flymake wants to be a part of the global infrastructure for major
modes, which includes setting variables for recent "fancy" stuff like
ElDoc (eldoc-documentation-function), and older stuff like newcomment.el
(comment-*), to give just two examples. My patch does the same for
Flymake and flymake-diagnostic-functions.
João
Re: [PATCH] Flymake support for C/C++, Richard Stallman, 2017/10/13
- Re: [PATCH] Flymake support for C/C++, Reuben Thomas, 2017/10/14
- Re: [PATCH] Flymake support for C/C++, Eli Zaretskii, 2017/10/14
- Re: [PATCH] Flymake support for C/C++, Reuben Thomas, 2017/10/14
- Re: [PATCH] Flymake support for C/C++, Dmitry Gutov, 2017/10/14
- Re: [PATCH] Flymake support for C/C++, Reuben Thomas, 2017/10/14
- Re: [PATCH] Flymake support for C/C++, Eli Zaretskii, 2017/10/14