summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2019-08-28 21:00:00 +0200
committerNoam Postavsky <npostavs@gmail.com>2019-09-07 16:51:24 -0400
commit8d588f09e91e315c715cf824a9819a538a85cd9c (patch)
treef21f366b2b5517a3b706c8ab7689b885b08dcd03 /lisp
parent14875443ff03d3c2b9cc63479e672957f99b730a (diff)
downloademacs-8d588f09e91e315c715cf824a9819a538a85cd9c.tar.gz
emacs-8d588f09e91e315c715cf824a9819a538a85cd9c.tar.bz2
emacs-8d588f09e91e315c715cf824a9819a538a85cd9c.zip
Fix flymake-proc temporary file deletion bug
* list/progmodes/flymake-proc.el (flymake-proc-create-temp-inplace): Include a time string part (hour + minute + second + nanosecond) in the temporary name to make it unique enough. (flymake-proc-legacy-flymake): Store temporary file names in the process for usage in the sentinel. (flymake-proc--process-sentinel): Bind values of temporary file names dynamically to values stored in the process so that the cleanup function will delete the correct temporary file(s). Fixes bug#31981.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/flymake-proc.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index 2d5a47a0797..f08ba2f3681 100644
--- a/lisp/progmodes/flymake-proc.el
+++ b/lisp/progmodes/flymake-proc.el
@@ -654,7 +654,14 @@ Create parent directories as needed."
(let ((cleanup-f (flymake-proc--get-cleanup-function
(buffer-file-name))))
(flymake-log 3 "cleaning up using %s" cleanup-f)
- (funcall cleanup-f))))
+ ;; Make cleanup-f see the temporary file names
+ ;; created by its corresponding init function
+ ;; (bug#31981).
+ (let ((flymake-proc--temp-source-file-name
+ (process-get proc 'flymake-proc--temp-source-file-name))
+ (flymake-proc--temp-master-file-name
+ (process-get proc 'flymake-proc--temp-master-file-name)))
+ (funcall cleanup-f)))))
(kill-buffer output-buffer)))))))
(defun flymake-proc--panic (problem explanation)
@@ -824,6 +831,10 @@ can also be executed interactively independently of
(process-put proc 'flymake-proc--output-buffer
(generate-new-buffer
(format " *flymake output for %s*" (current-buffer))))
+ (process-put proc 'flymake-proc--temp-source-file-name
+ flymake-proc--temp-source-file-name)
+ (process-put proc 'flymake-proc--temp-master-file-name
+ flymake-proc--temp-master-file-name)
(setq flymake-proc--current-process proc)
(flymake-log 2 "started process %d, command=%s, dir=%s"
(process-id proc) (process-command proc)
@@ -865,6 +876,7 @@ can also be executed interactively independently of
(let* ((ext (file-name-extension file-name))
(temp-name (file-truename
(concat (file-name-sans-extension file-name)
+ "_" (format-time-string "%H%M%S%N")
"_" prefix
(and ext (concat "." ext))))))
(flymake-log 3 "create-temp-inplace: file=%s temp=%s" file-name temp-name)