unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#55056: [PATCH] Delete temporary Flymake Elisp files
@ 2022-04-21 16:42 Philip Kaludercic
  2022-04-22 11:43 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Philip Kaludercic @ 2022-04-21 16:42 UTC (permalink / raw)
  To: 55056

[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]

Tags: patch


My temporary directory appears to always be littered with flymake files.
The reason for this appears to be that the Elisp Flymake backend doesn't
always clean up after itself, when it should.  In the worst case I can
run out of space and that can mess up a lot of things on a system.

The below patch adds a check to the sentinel to do so.  I was a bit
paranoid and considered more process-states that might be necessary, but
I hope that someone with a better understanding of the process interface
will be able to help here.

In GNU Emacs 29.0.50 (build 7, x86_64-pc-linux-gnu, GTK+ Version 2.24.33, cairo version 1.16.0)
 of 2022-04-18 built on icterid
Repository revision: 7b1881682bfbd1ff83d47b88fa8cca22c0290c17
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --with-native-compilation --with-cairo --with-harfbuzz
 LDFLAGS=-flto 'CFLAGS=-march=native -mtune=native -pipe''


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Delete-temporary-Flymake-Elisp-files-every-time-a-pr.patch --]
[-- Type: text/patch, Size: 1302 bytes --]

From 26eba81b8a05e394d495336749da171e1cdf355e Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Thu, 21 Apr 2022 17:04:19 +0200
Subject: [PATCH] Delete temporary Flymake Elisp files every time a process
 ends

* elisp-mode.el (elisp-flymake-byte-compile): Handle terminal process
states besides exit by also removing the temporary file.
---
 lisp/progmodes/elisp-mode.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 0dfff32f20..c99cf34db0 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -2101,7 +2101,11 @@ elisp-flymake-byte-compile
                            :explanation
                            (format "byte-compile process %s died" proc))))
               (ignore-errors (delete-file temp-file))
-              (kill-buffer output-buffer))))
+              (kill-buffer output-buffer)))
+          (when (memq (process-status proc) '(failed closed signal))
+            (message "Elisp flymake [%s]: %S" (buffer-file-name) (process-status proc))
+            (ignore-errors (delete-file temp-file))
+            (kill-buffer output-buffer)))
         :stderr " *stderr of elisp-flymake-byte-compile*"
         :noquery t)))))
 
-- 
2.30.2


[-- Attachment #3: Type: text/plain, Size: 24 bytes --]


-- 
	Philip Kaludercic

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

end of thread, other threads:[~2022-04-25  7:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 16:42 bug#55056: [PATCH] Delete temporary Flymake Elisp files Philip Kaludercic
2022-04-22 11:43 ` Lars Ingebrigtsen
2022-04-22 11:57   ` João Távora
2022-04-22 12:37     ` Lars Ingebrigtsen
2022-04-23 12:53       ` Lars Ingebrigtsen
2022-04-25  7:34         ` Philip Kaludercic
2022-04-25  7:42           ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).