Fix filesystem littering by Flymake's legacy backend
The Flymake legacy "proc" backend, which is active by default will try to syntax-check foo.c/foo.cpp and many other types of files, but on failing to find a suitable Makefile target, will fail. There's nothing wrong with that except that it used to leave behind the foo_flymake.c and foo_flymake.cpp auxiliary files behind, littering the filesystem. * lisp/progmodes/flymake-proc.el (flymake-proc-legacy-flymake): Call init-function inside of the unwind-protect.
This commit is contained in:
parent
b98cf9cdab
commit
934bb475b9
1 changed files with 36 additions and 36 deletions
|
@ -772,43 +772,43 @@ can also be executed interactively independently of
|
|||
(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))))))))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue