[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
delete-file succeeds without deleting the file
From: |
Michael Heerdegen |
Subject: |
delete-file succeeds without deleting the file |
Date: |
Mon, 11 Jan 2016 07:16:19 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Hello,
in my code, I want to use something like this:
--8<---------------cut here---------------start------------->8---
(defmacro foo-save-index (&rest body)
;; Modeled after `magit-with-temp-index'
(declare (debug t))
(macroexp-let2 nil temp-index-file '(expand-file-name (make-temp-name
"index.foo"))
`(unwind-protect
(let ((process-environment process-environment))
(setenv "GIT_INDEX_FILE" ,temp-index-file)
,@body)
(when (file-exists-p ,temp-index-file) (delete-file ,temp-index-file)))))
--8<---------------cut here---------------end--------------->8---
This makes it possible to work with a temporary git index while working
with git commands in BODY. All those commands are synchronous.
This works as expected, but in some, quite rare cases, the temporary
index file survives. There is no error, and delete-file seems to
terminate always successfully.
Anybody any idea how this can happen?
Thanks,
Michael.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- delete-file succeeds without deleting the file,
Michael Heerdegen <=