summaryrefslogtreecommitdiff
path: root/lisp/progmodes/flymake-proc.el
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2018-05-11 23:28:40 +0100
committerJoão Távora <joaotavora@gmail.com>2018-05-12 11:37:48 +0100
commit934bb475b9a729d0be4d78cd89c1d22d032ee3d7 (patch)
tree61272381858282ded2cd4958716a2201fe53cf47 /lisp/progmodes/flymake-proc.el
parentb98cf9cdabd710f89eb57645a163fd52db338404 (diff)
downloademacs-934bb475b9a729d0be4d78cd89c1d22d032ee3d7.tar.gz
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.
Diffstat (limited to 'lisp/progmodes/flymake-proc.el')
-rw-r--r--lisp/progmodes/flymake-proc.el72
1 files changed, 36 insertions, 36 deletions
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index c5bb79fee66..4792a945308 100644
--- a/lisp/progmodes/flymake-proc.el
+++ b/lisp/progmodes/flymake-proc.el
@@ -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))))))))