all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Very annoying Flymake regression in Emacs 26.1
@ 2018-05-11 21:35 João Távora
  2018-05-12  7:08 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: João Távora @ 2018-05-11 21:35 UTC (permalink / raw)
  To: Eli Zaretskii, emacs-devel, johnw

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))))))))
 









^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-05-13  5:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-11 21:35 Very annoying Flymake regression in Emacs 26.1 João Távora
2018-05-12  7:08 ` 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

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.