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 22:24:59 +0100	[thread overview]
Message-ID: <87infkm53o.fsf@gmail.com> (raw)
In-Reply-To: <20171012203953.GB6106@ACM> (Alan Mackenzie's message of "Thu, 12 Oct 2017 20:39:53 +0000")

Hello again, Alan.

Alan Mackenzie <acm@muc.de> writes:

> Yes.  It tightly couples Flymake Mode with CC Mode.  It would render CC
> Mode non-functional in the absence of Flymake Mode.

If this your criteria for "tightly coupled", then it does not apply
here. c--setup-flymake simply adds to a(n abnormal) hook, using
add-hook, which is designed to be used even if the hook variable isn't
defined yet.

(There is actually a bit of unglyness in the current patch, in which
c--setup-flymake also `defvar's and `setq-local's another obsolete
variable. I could remove that bit and come up with a pure add-hook
solution.)

> thus adding to a CC Mode hook.  Major mode hooks are usually not used by
> Emacs itself, but I'm not aware of any convention which prohibits it.

Perhaps the example that I gave you is one of the reaons.

> OK, so f-d-functions could be set in c-mode-common-hook then, couldn't
> it?

No, for the reasons that I restate below.

> I don't understand that last bit.  What's the difference between
> activation and setup?

Activation is enabling the minor mode via the flymake-mode
function. Setup is ensuring that that activation is met with suitable
circunstances for the correct operation of the minor mode, in this case
that cc-specific "backends" are set.

> It would seem then, the activation has nothing to
> do with the major mode, or else it could be done in a major mode hook.
> What am I missing here?

You are not mistaken that activation has nothing to do with the major
mode, but you are missing that there are two steps, activation and
setup, that the differ in the ways I hope to have clarified above.

> "Those two" being activation and setup?

No sorry, those two being the two hooks that you suggested.

> What do they need which is in CC Mode?

They need to hook on to the major mode's function.

> And how would a new CC Mode hook
> help?

That would appease your wish for very loose coupling in that no mention
of the word "flymake" needed to appear in cc-mode.el

> Would you be wanting it to be run before CC Mode is fully initialised?

Doesn't matter really, before the user's c-mode-common-hook is fine.

> "Do one thing and do it well".  Let's not get into the "do it well"
> bit here, but the "do one thing" is "edit C/C++/... buffers".  Flymake
> would appear to be distinct from that one thing.

Ah, I so do agree with you Alan... and let's get not into the million
ways Emacs is already the kitchen sink. Flymake can be as useful to a
pretty broad definition of "editing" as font-locking, or imenu, or
outline.el, or supporting add-log-current-defun-function. All those
things that really aren't "editing", but help you edit.

> What does Flymake do, anyway?

It highlights the bits where you make mistakes as you type, or are about
to.

> There's nothing in the Emacs manual
> about it, and it's doc string consists purely of boilerplate, at least
> in Emacs 25.3.

That is true, but the situation changes considerably, if not immensely,
in emacs 26 :-). I rewrote Flymake and wrote a fair amount of
documention. You can read the documentaion in Texinfo format in the
"Flymake" node (which is separate from the Emacs user manual, for now)
or just C-h f flymake-mode RET in a recent emacs-26 or master build.

> But it should be loosely coupled with major modes, not tightly coupled,
> surely?

For sure, we agree. If you analyse the situation I think you'll come to
the conclusion that it is.

João




  parent reply	other threads:[~2017-10-12 21:24 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
2017-10-12 20:39     ` Alan Mackenzie
2017-10-12 21:05       ` Stefan Monnier
2017-10-12 21:24       ` João Távora [this message]
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=87infkm53o.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).