all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org, johnw@gnu.org
Subject: Very annoying Flymake regression in Emacs 26.1
Date: Fri, 11 May 2018 22:35:50 +0100	[thread overview]
Message-ID: <87o9hlub7t.fsf@gmail.com> (raw)

Eli, John,

I have noticed that I introduced quite an annoying regression in the
Flymake redesign that's about to make it it 26.1.

The bug happens like this. There's nothing wrong until 5.

 1. Navigate to a foo.c file
 2. Turn on M-x flymake-mode
 3. Because the legacy "proc" backend is active by default, flymake
 calls it and it makes its usual foo_flymake.c copies before doing its
 thing which is to call "CHK_SOURCES=foo_flymake.c make check-syntax"
 4. If there isn't such a target in the Makefile, or if there isn't any Makefile,
 the backend reports a failure and flymake.el considers it disabled.
 5. Nothing wrong until here, the problem is that the foo_flymake.c in
 step 3 is never cleaned up, and this starts littering the filesystem
 everytime you visit a .c file.

It's a very simple fix of moving an `unwind-protect' a level up the
tree. The diff looks big because of the indentation.  I attach it after
the sig. Sorry for noticing this so late in the game.

João

diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index c5bb79fee6..4792a94530 100644
--- a/lisp/progmodes/flymake-proc.el
+++ b/lisp/progmodes/flymake-proc.el
@@ -772,43 +772,43 @@ flymake-proc-legacy-flymake
         (flymake-proc--clear-buildfile-cache)
         (flymake-proc--clear-project-include-dirs-cache)
 
-        (let* ((cleanup-f (flymake-proc--get-cleanup-function buffer-file-name))
-               (cmd-and-args (funcall init-f))
-               (cmd          (nth 0 cmd-and-args))
-               (args         (nth 1 cmd-and-args))
-               (dir          (nth 2 cmd-and-args))
-               (success nil))
+        (let ((cleanup-f (flymake-proc--get-cleanup-function buffer-file-name))
+              (success nil))
           (unwind-protect
-              (cond
-               ((not cmd-and-args)
-                (flymake-log 1 "init function %s for %s failed, cleaning up"
-                             init-f buffer-file-name))
-               (t
-                (setq proc
-                      (let ((default-directory (or dir default-directory)))
-                        (when dir
-                          (flymake-log 3 "starting process on dir %s" dir))
-                        (make-process
-                         :name "flymake-proc"
-                         :buffer (current-buffer)
-                         :command (cons cmd args)
-                         :noquery t
-                         :filter
-                         (lambda (proc string)
-                           (let ((flymake-proc--report-fn report-fn))
-                             (flymake-proc--process-filter proc string)))
-                         :sentinel
-                         (lambda (proc event)
-                           (let ((flymake-proc--report-fn report-fn))
-                             (flymake-proc--process-sentinel proc event))))))
-                (process-put proc 'flymake-proc--output-buffer
-                             (generate-new-buffer
-                              (format " *flymake output for %s*" (current-buffer))))
-                (setq flymake-proc--current-process proc)
-                (flymake-log 2 "started process %d, command=%s, dir=%s"
-                             (process-id proc) (process-command proc)
-                             default-directory)
-                (setq success t)))
+              (let* ((cmd-and-args (funcall init-f))
+                     (cmd          (nth 0 cmd-and-args))
+                     (args         (nth 1 cmd-and-args))
+                     (dir          (nth 2 cmd-and-args)))
+                (cond
+                 ((not cmd-and-args)
+                  (flymake-log 1 "init function %s for %s failed, cleaning up"
+                               init-f buffer-file-name))
+                 (t
+                  (setq proc
+                        (let ((default-directory (or dir default-directory)))
+                          (when dir
+                            (flymake-log 3 "starting process on dir %s" dir))
+                          (make-process
+                           :name "flymake-proc"
+                           :buffer (current-buffer)
+                           :command (cons cmd args)
+                           :noquery t
+                           :filter
+                           (lambda (proc string)
+                             (let ((flymake-proc--report-fn report-fn))
+                               (flymake-proc--process-filter proc string)))
+                           :sentinel
+                           (lambda (proc event)
+                             (let ((flymake-proc--report-fn report-fn))
+                               (flymake-proc--process-sentinel proc event))))))
+                  (process-put proc 'flymake-proc--output-buffer
+                               (generate-new-buffer
+                                (format " *flymake output for %s*" (current-buffer))))
+                  (setq flymake-proc--current-process proc)
+                  (flymake-log 2 "started process %d, command=%s, dir=%s"
+                               (process-id proc) (process-command proc)
+                               default-directory)
+                  (setq success t))))
             (unless success
               (funcall cleanup-f))))))))
 









             reply	other threads:[~2018-05-11 21:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-11 21:35 João Távora [this message]
2018-05-12  7:08 ` Very annoying Flymake regression in Emacs 26.1 Eli Zaretskii
2018-05-12  9:01   ` João Távora
2018-05-12  9:33     ` Eli Zaretskii
2018-05-12 10:41       ` João Távora
2018-05-12 10:45         ` Eli Zaretskii
2018-05-13  5:03         ` John Wiegley

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

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

  git send-email \
    --in-reply-to=87o9hlub7t.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=johnw@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.