all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Glenn Morris <rgm@gnu.org>
To: emacs-devel@gnu.org
Subject: Re: Cleanup of byte-compiled files missing?
Date: Tue, 21 Sep 2010 21:33:47 -0400	[thread overview]
Message-ID: <hdd3s6ftok.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <wyiq2446a6.fsf@fencepost.gnu.org> (Glenn Morris's message of "Fri\, 17 Sep 2010 13\:41\:05 -0400")


Here's a patch that seems to work, but I do not know if it is the
right thing to do. As well as running kill-emacs-hook in batch mode,
it is necessary to trap SIGINT.

Maybe it would be better to write the tempfiles to temporary-file-directory?

Still, if you interrupt make a lot, at least the current behaviour
must be better than the old, which would have left you wih
half-written .elc files.


=== modified file 'lisp/emacs-lisp/bytecomp.el'
*** lisp/emacs-lisp/bytecomp.el	2010-09-17 14:31:06 +0000
--- lisp/emacs-lisp/bytecomp.el	2010-09-20 22:44:37 +0000
***************
*** 1698,1709 ****
  	  (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)))
  		  (if (memq system-type '(ms-dos 'windows-nt))
  		      (setq buffer-file-type t))
  		  (write-region (point-min) (point-max) tempfile nil 1)
--- 1698,1712 ----
  	  (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))
! 		       (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)

=== modified file 'src/emacs.c'
*** src/emacs.c	2010-09-21 11:13:36 +0000
--- src/emacs.c	2010-09-21 20:31:42 +0000
***************
*** 374,380 ****
      {
        fatal_error_in_progress = 1;
  
!       if (sig == SIGTERM || sig == SIGHUP)
          Fkill_emacs (make_number (sig));
  
        shut_down_emacs (sig, 0, Qnil);
--- 374,380 ----
      {
        fatal_error_in_progress = 1;
  
!       if (sig == SIGTERM || sig == SIGHUP || sig == SIGINT)
          Fkill_emacs (make_number (sig));
  
        shut_down_emacs (sig, 0, Qnil);
***************
*** 1236,1241 ****
--- 1236,1242 ----
  #ifdef SIGSYS
        signal (SIGSYS, fatal_error_signal);
  #endif
+       if ( noninteractive ) signal (SIGINT, fatal_error_signal);
        signal (SIGTERM, fatal_error_signal);
  #ifdef SIGXCPU
        signal (SIGXCPU, fatal_error_signal);
***************
*** 1992,1998 ****
    if (feof (stdin))
      arg = Qt;
  
!   if (!NILP (Vrun_hooks) && !noninteractive)
      call1 (Vrun_hooks, intern ("kill-emacs-hook"));
  
    UNGCPRO;
--- 1993,1999 ----
    if (feof (stdin))
      arg = Qt;
  
!   if (!NILP (Vrun_hooks))
      call1 (Vrun_hooks, intern ("kill-emacs-hook"));
  
    UNGCPRO;
***************
*** 2413,2419 ****
  expect to be able to interact with the user.  To ask for confirmation,
  see `kill-emacs-query-functions' instead.
  
! The hook is not run in batch mode, i.e., if `noninteractive' is non-nil.  */);
    Vkill_emacs_hook = Qnil;
  
    DEFVAR_INT ("emacs-priority", &emacs_priority,
--- 2414,2421 ----
  expect to be able to interact with the user.  To ask for confirmation,
  see `kill-emacs-query-functions' instead.
  
! Before Emacs 24.1, the hook was not run in batch mode, i.e., if
! `noninteractive' was non-nil.  */);
    Vkill_emacs_hook = Qnil;
  
    DEFVAR_INT ("emacs-priority", &emacs_priority,





  parent reply	other threads:[~2010-09-22  1:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-17 16:07 Cleanup of byte-compiled files missing? Lars Magne Ingebrigtsen
2010-09-17 16:18 ` Glenn Morris
2010-09-17 17:41 ` Glenn Morris
2010-09-17 18:37   ` Eli Zaretskii
2010-09-17 19:55     ` Glenn Morris
2010-09-17 19:59   ` Glenn Morris
2010-09-22  1:33   ` Glenn Morris [this message]
2010-09-22  7:18     ` Eli Zaretskii
2010-10-02  2:32       ` Glenn Morris
2010-10-02  8:25         ` Eli Zaretskii
2010-10-02 19:07           ` Glenn Morris
2010-10-02  8:28         ` Eli Zaretskii
2010-10-02 18:59           ` Glenn Morris
2010-10-02 19:55             ` Eli Zaretskii
2010-09-22 14:30     ` Davis Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=hdd3s6ftok.fsf@fencepost.gnu.org \
    --to=rgm@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.