diff options
| author | João Távora | 2018-05-11 23:28:40 +0100 |
|---|---|---|
| committer | João Távora | 2018-05-12 11:37:48 +0100 |
| commit | 934bb475b9a729d0be4d78cd89c1d22d032ee3d7 (patch) | |
| tree | 61272381858282ded2cd4958716a2201fe53cf47 | |
| parent | b98cf9cdabd710f89eb57645a163fd52db338404 (diff) | |
| download | emacs-934bb475b9a729d0be4d78cd89c1d22d032ee3d7.tar.gz emacs-934bb475b9a729d0be4d78cd89c1d22d032ee3d7.zip | |
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.
| -rw-r--r-- | lisp/progmodes/flymake-proc.el | 72 |
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 | |||
| 772 | (flymake-proc--clear-buildfile-cache) | 772 | (flymake-proc--clear-buildfile-cache) |
| 773 | (flymake-proc--clear-project-include-dirs-cache) | 773 | (flymake-proc--clear-project-include-dirs-cache) |
| 774 | 774 | ||
| 775 | (let* ((cleanup-f (flymake-proc--get-cleanup-function buffer-file-name)) | 775 | (let ((cleanup-f (flymake-proc--get-cleanup-function buffer-file-name)) |
| 776 | (cmd-and-args (funcall init-f)) | 776 | (success nil)) |
| 777 | (cmd (nth 0 cmd-and-args)) | ||
| 778 | (args (nth 1 cmd-and-args)) | ||
| 779 | (dir (nth 2 cmd-and-args)) | ||
| 780 | (success nil)) | ||
| 781 | (unwind-protect | 777 | (unwind-protect |
| 782 | (cond | 778 | (let* ((cmd-and-args (funcall init-f)) |
| 783 | ((not cmd-and-args) | 779 | (cmd (nth 0 cmd-and-args)) |
| 784 | (flymake-log 1 "init function %s for %s failed, cleaning up" | 780 | (args (nth 1 cmd-and-args)) |
| 785 | init-f buffer-file-name)) | 781 | (dir (nth 2 cmd-and-args))) |
| 786 | (t | 782 | (cond |
| 787 | (setq proc | 783 | ((not cmd-and-args) |
| 788 | (let ((default-directory (or dir default-directory))) | 784 | (flymake-log 1 "init function %s for %s failed, cleaning up" |
| 789 | (when dir | 785 | init-f buffer-file-name)) |
| 790 | (flymake-log 3 "starting process on dir %s" dir)) | 786 | (t |
| 791 | (make-process | 787 | (setq proc |
| 792 | :name "flymake-proc" | 788 | (let ((default-directory (or dir default-directory))) |
| 793 | :buffer (current-buffer) | 789 | (when dir |
| 794 | :command (cons cmd args) | 790 | (flymake-log 3 "starting process on dir %s" dir)) |
| 795 | :noquery t | 791 | (make-process |
| 796 | :filter | 792 | :name "flymake-proc" |
| 797 | (lambda (proc string) | 793 | :buffer (current-buffer) |
| 798 | (let ((flymake-proc--report-fn report-fn)) | 794 | :command (cons cmd args) |
| 799 | (flymake-proc--process-filter proc string))) | 795 | :noquery t |
| 800 | :sentinel | 796 | :filter |
| 801 | (lambda (proc event) | 797 | (lambda (proc string) |
| 802 | (let ((flymake-proc--report-fn report-fn)) | 798 | (let ((flymake-proc--report-fn report-fn)) |
| 803 | (flymake-proc--process-sentinel proc event)))))) | 799 | (flymake-proc--process-filter proc string))) |
| 804 | (process-put proc 'flymake-proc--output-buffer | 800 | :sentinel |
| 805 | (generate-new-buffer | 801 | (lambda (proc event) |
| 806 | (format " *flymake output for %s*" (current-buffer)))) | 802 | (let ((flymake-proc--report-fn report-fn)) |
| 807 | (setq flymake-proc--current-process proc) | 803 | (flymake-proc--process-sentinel proc event)))))) |
| 808 | (flymake-log 2 "started process %d, command=%s, dir=%s" | 804 | (process-put proc 'flymake-proc--output-buffer |
| 809 | (process-id proc) (process-command proc) | 805 | (generate-new-buffer |
| 810 | default-directory) | 806 | (format " *flymake output for %s*" (current-buffer)))) |
| 811 | (setq success t))) | 807 | (setq flymake-proc--current-process proc) |
| 808 | (flymake-log 2 "started process %d, command=%s, dir=%s" | ||
| 809 | (process-id proc) (process-command proc) | ||
| 810 | default-directory) | ||
| 811 | (setq success t)))) | ||
| 812 | (unless success | 812 | (unless success |
| 813 | (funcall cleanup-f)))))))) | 813 | (funcall cleanup-f)))))))) |
| 814 | 814 | ||