Fix spurious errors on Windows when deleting temporary *.eln files

* lisp/emacs-lisp/comp.el (comp--native-compile): On MS-Windows,
ignore errors when deleting a temporary .eln file.  (Bug#60996)
This commit is contained in:
Eli Zaretskii 2023-01-29 09:44:53 +02:00
parent 2bd0b94753
commit 56e8607dc9

View file

@ -4112,13 +4112,16 @@ the deferred compilation mechanism."
(native-elisp-load data)))
;; We may have created a temporary file when we're being
;; called with something other than a file as the argument.
;; Delete it.
;; Delete it if we can.
(when (and (not (stringp function-or-file))
(not output)
comp-ctxt
(comp-ctxt-output comp-ctxt)
(file-exists-p (comp-ctxt-output comp-ctxt)))
(delete-file (comp-ctxt-output comp-ctxt))))))))
(cond ((eq 'windows-nt system-type)
;; We may still be using the temporary .eln file.
(ignore-errors (delete-file (comp-ctxt-output comp-ctxt))))
(t (delete-file (comp-ctxt-output comp-ctxt))))))))))
(defun native-compile-async-skip-p (file load selector)
"Return non-nil if FILE's compilation should be skipped.