unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: joaotavora@gmail.com (João Távora)
To: Alan Mackenzie <acm@muc.de>
Cc: eliz@gnu.org, npostavs@users.sourceforge.net, sdl.web@gmail.com,
	monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: [PATCH] Flymake support for C/C++
Date: Thu, 12 Oct 2017 19:46:20 +0100	[thread overview]
Message-ID: <87tvz4mcg3.fsf@gmail.com> (raw)
In-Reply-To: <20171012175044.GA6106@ACM> (Alan Mackenzie's message of "Thu, 12 Oct 2017 17:50:44 +0000")

Hi Alan,

Thanks for the quick reply.

Alan Mackenzie <acm@muc.de> 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




  parent reply	other threads:[~2017-10-12 18:46 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12 15:09 [PATCH] Flymake support for C/C++ João Távora
2017-10-12 15:50 ` Mark Oteiza
2017-10-12 17:50 ` Alan Mackenzie
2017-10-12 18:45   ` Stefan Monnier
2017-10-12 20:45     ` Alan Mackenzie
2017-10-12 21:03       ` Stefan Monnier
2017-10-13  6:28       ` Eli Zaretskii
2017-10-12 18:46   ` João Távora [this message]
2017-10-12 20:39     ` Alan Mackenzie
2017-10-12 21:05       ` Stefan Monnier
2017-10-12 21:24       ` João Távora
2018-06-01 21:07         ` Alan Mackenzie
2018-06-01 21:54           ` João Távora
2018-06-01 22:08             ` Stefan Monnier
2018-06-01 23:23               ` Rolf Ade
2018-06-02 10:33             ` Alan Mackenzie
2018-06-02 14:44               ` Stefan Monnier
2018-06-02 18:13               ` João Távora
2018-06-03 15:45                 ` Alan Mackenzie
2018-06-03 16:28                   ` João Távora
2018-06-03 16:43                     ` Alan Mackenzie
2018-06-03 17:02                       ` João Távora
2018-06-02 17:16           ` Stefan Monnier
2018-06-02 15:26   ` Stefan Monnier
2018-06-03 13:44     ` Alan Mackenzie
2017-10-14  1:34 ` Richard Stallman
2017-10-14  7:10   ` Reuben Thomas
2017-10-14  7:58     ` Sami Kerola
2017-10-14  8:00     ` Eli Zaretskii
2017-10-14  8:15       ` Reuben Thomas
2017-10-14  8:22         ` Dmitry Gutov
2017-10-14  8:29           ` Reuben Thomas
2017-10-14 10:36             ` Eli Zaretskii
2017-10-14 11:22               ` Reuben Thomas
2017-10-14  8:33         ` Eli Zaretskii
2017-10-17 10:53           ` Phillip Lord
2017-10-17 10:56             ` Reuben Thomas
2017-10-18  4:03               ` Richard Stallman
2017-10-18 10:18                 ` Reuben Thomas
2017-10-19  3:26                   ` Richard Stallman
2017-10-19  7:38                     ` Reuben Thomas
2017-10-22 23:18                       ` Richard Stallman
2017-10-22 23:23                         ` Reuben Thomas
2017-10-24  4:12                           ` Richard Stallman
2017-10-24  9:45                             ` Reuben Thomas
2017-10-24  9:48                               ` Dmitry Gutov
2017-10-24  9:52                                 ` Reuben Thomas
2017-10-24  9:57                                   ` Dmitry Gutov
2017-10-24 10:07                                     ` Reuben Thomas
2017-10-24 10:21                                       ` Dmitry Gutov
2017-10-24 10:28                                         ` Reuben Thomas
2017-10-24 15:44                                   ` Stefan Monnier
2017-10-25 19:30                               ` Richard Stallman
2017-10-27  0:43                                 ` Reuben Thomas
2017-10-28 21:47                                   ` Richard Stallman
2017-10-18 12:16           ` Clément Pit-Claudel
2017-10-18 17:30             ` John Wiegley
2017-10-14 13:55         ` Stefan Monnier
2017-10-14  9:33     ` João Távora
2017-10-14 10:56       ` guillaume papin
2017-10-14 16:29         ` João Távora
2017-10-14 16:36           ` Reuben Thomas
2017-10-18 12:22           ` Clément Pit-Claudel
2017-10-18 14:26             ` João Távora
2017-10-14  9:29   ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tvz4mcg3.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=npostavs@users.sourceforge.net \
    --cc=sdl.web@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).