Run kill-emacs-hook in batch mode, and on SIGINT in batch mode.
See thread http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg00795.html * src/emacs.c (fatal_error_signal): Also run Fkill_emacs on SIGINT. (main) [!WINDOWSNT]: Handle SIGINT with fatal_error_signal in batch-mode. (Fkill_emacs): Doc fix. Also run the hook in batch mode. (kill-emacs-hook): Doc fix. * lisp/emacs-lisp/bytecomp.el (byte-compile-file): Use kill-emacs-hook to delete tempfile if interrupted during compilation. * doc/lispref/os.texi (Killing Emacs): Hook now runs in batch mode. * etc/NEWS: Mention these changes.
This commit is contained in:
parent
08b8ba9fae
commit
9c524fcb89
7 changed files with 46 additions and 10 deletions
|
@ -1698,12 +1698,15 @@ The value is non-nil if there were no errors, nil if errors."
|
|||
(insert "\n") ; aaah, unix.
|
||||
(if (file-writable-p target-file)
|
||||
;; We must disable any code conversion here.
|
||||
(let ((coding-system-for-write 'no-conversion)
|
||||
;; Write to a tempfile so that if another Emacs
|
||||
;; process is trying to load target-file (eg in a
|
||||
;; parallel bootstrap), it does not risk getting a
|
||||
;; half-finished file. (Bug#4196)
|
||||
(tempfile (make-temp-name target-file)))
|
||||
(let* ((coding-system-for-write 'no-conversion)
|
||||
;; Write to a tempfile so that if another Emacs
|
||||
;; process is trying to load target-file (eg in a
|
||||
;; parallel bootstrap), it does not risk getting a
|
||||
;; half-finished file. (Bug#4196)
|
||||
(tempfile (make-temp-name target-file))
|
||||
(kill-emacs-hook
|
||||
(cons (lambda () (ignore-errors (delete-file tempfile)))
|
||||
kill-emacs-hook)))
|
||||
(if (memq system-type '(ms-dos 'windows-nt))
|
||||
(setq buffer-file-type t))
|
||||
(write-region (point-min) (point-max) tempfile nil 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue