From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Flymake support for C/C++ Date: Thu, 12 Oct 2017 22:24:59 +0100 Message-ID: <87infkm53o.fsf@gmail.com> References: <87zi8wmmhw.fsf@gmail.com> <20171012175044.GA6106@ACM> <87tvz4mcg3.fsf@gmail.com> <20171012203953.GB6106@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1507843533 13560 195.159.176.226 (12 Oct 2017 21:25:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 12 Oct 2017 21:25:33 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: eliz@gnu.org, npostavs@users.sourceforge.net, sdl.web@gmail.com, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 12 23:25:24 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2kyj-0001fZ-T2 for ged-emacs-devel@m.gmane.org; Thu, 12 Oct 2017 23:25:18 +0200 Original-Received: from localhost ([::1]:47300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2kym-0003Fu-7t for ged-emacs-devel@m.gmane.org; Thu, 12 Oct 2017 17:25:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2kya-0003E1-68 for emacs-devel@gnu.org; Thu, 12 Oct 2017 17:25:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e2kyZ-0007jW-1n for emacs-devel@gnu.org; Thu, 12 Oct 2017 17:25:08 -0400 Original-Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:49886) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e2kyV-0007ec-7u; Thu, 12 Oct 2017 17:25:03 -0400 Original-Received: by mail-wm0-x232.google.com with SMTP id b189so16429241wmd.4; Thu, 12 Oct 2017 14:25:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=5oCWMN3PxYiMzXiqyUZnAhIFZyjtoQt2Lel/i41b768=; b=YED/A/e3i1GIiw6c5ATOhiOJJTKR8Lr9FXP6df+F4W6s84dtyr9+hi/UXb2aMyMvhi NYBmigN7KHFUL8Vj5iVswGW2nNOr3eeH/7jav48g72Ru0DG99S00PYEmYsEyDX0Ky9xy Kyr2L/su2MoLGCS+GmGgzh/eCjUHLi4ZiZkzO/nLjhNPTV70bFWg5OtFVKKL9WxeNsIa qdGzdVaTTh99eCQP0k3l0jX9iRXBt+Gau0/oihz6r66cvMQobXZJ+rLPHbqVDXXLXFXe GpEZYXeLOPEZuTu0HhJ7pPFMwP7JoJntRgXdLcTP+qkjfN/6UR99rM/2jormf5sIfLoa aMrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=5oCWMN3PxYiMzXiqyUZnAhIFZyjtoQt2Lel/i41b768=; b=NYPkSPGsYVQ4hgX64u9XW8wVLK1GSlhNU6bvXuLvO54yqK+9rrrvLAHWX71weNu6Ub BlFIDi9MtKgQi2jP5rK7rvbIJnk9hiwRLXJjOQCpkjPI17oOMtjdyirXqgYzj69MqfYS 0ByLXDaiAGfGNLhLgTgyhtUw0CyHyZ0Ckw+KJhZsdn/dFZVvdQxbSuVLAeC1t9SCbP92 Q1QDUbb1k2Z7SOKQ2r5yH9cqAvrE9C1hcA6lMk36sqtQNdI3w7VqOXXgaJHNJpmN6KPq i0p1GYDcpK6ha9MpcR2TK7J/HiWkutabGPYpf+QI//LSJ7g4ZcGCwSGFLMDsU11l8Kfp rM0w== X-Gm-Message-State: AMCzsaXCSY2tPQAgH6b7Io8cBrBDaLcOu2ppM5R3p9V7wAHZlR89WiOG XVjbL7cmhBw3GacD3yySLtY= X-Google-Smtp-Source: AOwi7QBYVZyO15ATBLz+sio7zYBDnZyAItVStioEJWCYGUDtEDFWE8q4YJ9LqG9uKavDnHMbn3hk1w== X-Received: by 10.223.186.20 with SMTP id o20mr3775689wrg.3.1507843502122; Thu, 12 Oct 2017 14:25:02 -0700 (PDT) Original-Received: from lolita.yourcompany.com (188.139.62.94.rev.vodafone.pt. [94.62.139.188]) by smtp.gmail.com with ESMTPSA id v23sm999550wmv.0.2017.10.12.14.25.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Oct 2017 14:25:01 -0700 (PDT) In-Reply-To: <20171012203953.GB6106@ACM> (Alan Mackenzie's message of "Thu, 12 Oct 2017 20:39:53 +0000") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::232 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:219434 Archived-At: Hello again, Alan. Alan Mackenzie 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=C3=A3o