I am using emacs on a server so files in
/tmp are not automatically cleared down. Every time
inferior-python-mode runs, it leaves files in
I'm looking for a more elegant way to delete these temporary files when they're no longer needed. I assume these files are only needed by the shell to load and could, in theory, be deleted immediately afterwards but I don't know how to achieve this. As a compromise, I delete all my
/tmp/py* files when I kill emacs:
;; cleanup on aisle 6 (add-hook 'kill-emacs-hook (lambda () (shell-command "find /tmp -maxdepth 1 -name 'py*' -type f -user \"$LOGNAME\" -print0 | xargs -0r rm -f")))
This seems a bit drastic and could very well delete a temporary file that is still needed by something else. How can I delete these files more precisely?
EDIT: Am using emacs 24.3, GNU tell me this is a known bug and does not exist after 25.1. Is anyone able to suggest a more elegant workaround until we upgrade?