all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#8137: Requiring a file during bytecompilation runs that file's kill-emacs-hook.
@ 2011-02-28  5:13 Juanma Barranquero
  2011-02-28  9:28 ` martin rudalics
  2011-02-28 17:23 ` Chong Yidong
  0 siblings, 2 replies; 10+ messages in thread
From: Juanma Barranquero @ 2011-02-28  5:13 UTC (permalink / raw)
  To: 8137

Package: emacs
Version: 24.0.50


After this change (from a few months ago, but I just discovered):

revno: 101722
committer: Glenn Morris <rgm@gnu.org>
branch nick: trunk
timestamp: Fri 2010-10-01 19:30:11 -0700
message:
  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.


compiling code requiring a file that sets kill-emacs-hook runs that
hook, for example

;;; bug.el
(require 'saveplace)
;;; end of bug.el

emacs -batch -Q -f batch-byte-compile bug.el
Wrote c:/emacs/repo/bug.elc
Wrote c:/my_home/.emacs-places


    Juanma





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#8137: Requiring a file during bytecompilation runs that file's kill-emacs-hook.
  2011-02-28  5:13 bug#8137: Requiring a file during bytecompilation runs that file's kill-emacs-hook Juanma Barranquero
@ 2011-02-28  9:28 ` martin rudalics
  2011-02-28 12:27   ` Juanma Barranquero
  2011-02-28 17:23 ` Chong Yidong
  1 sibling, 1 reply; 10+ messages in thread
From: martin rudalics @ 2011-02-28  9:28 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 8137

 > After this change (from a few months ago, but I just discovered):
 >
 > revno: 101722
 > committer: Glenn Morris <rgm@gnu.org>
 > branch nick: trunk
 > timestamp: Fri 2010-10-01 19:30:11 -0700
 > message:
 >   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.
 >
 >
 > compiling code requiring a file that sets kill-emacs-hook runs that
 > hook, for example
 >
 > ;;; bug.el
 > (require 'saveplace)
 > ;;; end of bug.el
 >
 > emacs -batch -Q -f batch-byte-compile bug.el
 > Wrote c:/emacs/repo/bug.elc
 > Wrote c:/my_home/.emacs-places

Could this be also the cause of

bug#8134: (Some special files were saved without asking)

?

martin





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#8137: Requiring a file during bytecompilation runs that file's kill-emacs-hook.
  2011-02-28  9:28 ` martin rudalics
@ 2011-02-28 12:27   ` Juanma Barranquero
  2011-02-28 14:14     ` martin rudalics
  0 siblings, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2011-02-28 12:27 UTC (permalink / raw)
  To: martin rudalics; +Cc: 8137

On Mon, Feb 28, 2011 at 10:28, martin rudalics <rudalics@gmx.at> wrote:

> Could this be also the cause of
>
> bug#8134: (Some special files were saved without asking)

Hard to say, given the amount of detail provided by jidanni.

    Juanma





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#8137: Requiring a file during bytecompilation runs that file's kill-emacs-hook.
  2011-02-28 12:27   ` Juanma Barranquero
@ 2011-02-28 14:14     ` martin rudalics
  0 siblings, 0 replies; 10+ messages in thread
From: martin rudalics @ 2011-02-28 14:14 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 8137, jidanni

 >> Could this be also the cause of
 >>
 >> bug#8134: (Some special files were saved without asking)
 >
 > Hard to say, given the amount of detail provided by jidanni.

IIRC he's very fond of compiling his .emacs.  So if he has set
`buffer-save-without-query' to non-nil, the message above might be a
consequence of the bug you described (IIUC one can get that message only
if that option is non-nil).

martin





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#8137: Requiring a file during bytecompilation runs that file's kill-emacs-hook.
  2011-02-28  5:13 bug#8137: Requiring a file during bytecompilation runs that file's kill-emacs-hook Juanma Barranquero
  2011-02-28  9:28 ` martin rudalics
@ 2011-02-28 17:23 ` Chong Yidong
  2011-03-03 17:18   ` Juanma Barranquero
  1 sibling, 1 reply; 10+ messages in thread
From: Chong Yidong @ 2011-02-28 17:23 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 8137

Juanma Barranquero <lekktu@gmail.com> writes:

> compiling code requiring a file that sets kill-emacs-hook runs that
> hook, for example
>
> ;;; bug.el
> (require 'saveplace)
> ;;; end of bug.el
>
> emacs -batch -Q -f batch-byte-compile bug.el
> Wrote c:/emacs/repo/bug.elc
> Wrote c:/my_home/.emacs-places

This doesn't seem like it's related to Glenn's change.  From a brief
look at saveplace.el, it looks like the problem isn't limited to byte
compilation: the saveplace file would be written anytime Emacs is run
noninteractively while it's loaded (e.g. from a user's init file).
Probably saveplace.el needs to be changed so that it doesn't do anything
when noninteractive.

There are nine other places in Emacs that add to kill-emacs-hook at
top-level, which ought to be checked too.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#8137: Requiring a file during bytecompilation runs that file's kill-emacs-hook.
  2011-02-28 17:23 ` Chong Yidong
@ 2011-03-03 17:18   ` Juanma Barranquero
  2011-03-05 20:24     ` Chong Yidong
  0 siblings, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2011-03-03 17:18 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 8137

On Mon, Feb 28, 2011 at 18:23, Chong Yidong <cyd@stupidchicken.com> wrote:

> There are nine other places in Emacs that add to kill-emacs-hook at
> top-level, which ought to be checked too.

There are twelve places, counting Org.

bookmark.el
desktop.el
emacs-lock.el
ps-print.el
saveplace.el
net/tramp-cache.el
obsolete/fast-lock.el
org/ob.el
org/org-id.el
progmodes/ps-mode.el
textmodes/reftex.el
textmodes/tex-mode.el

There's no obvious case (that I can see) designed for non-interactive
use, so I'd say let's apply the change and see whether someone
complains.

    Juanma




=== modified file 'lisp/bookmark.el'
--- lisp/bookmark.el	2011-02-10 16:56:00 +0000
+++ lisp/bookmark.el	2011-03-03 16:58:14 +0000
@@ -2181,7 +2181,8 @@
        (bookmark-time-to-save-p t)
        (bookmark-save)))

-(add-hook 'kill-emacs-hook 'bookmark-exit-hook-internal)
+(unless noninteractive
+  (add-hook 'kill-emacs-hook 'bookmark-exit-hook-internal))

 (defun bookmark-unload-function ()
   "Unload the Bookmark library."

=== modified file 'lisp/desktop.el'
--- lisp/desktop.el	2011-01-26 08:36:39 +0000
+++ lisp/desktop.el	2011-03-03 16:57:13 +0000
@@ -611,7 +611,8 @@
   (delete-other-windows))

 ;; ----------------------------------------------------------------------------
-(add-hook 'kill-emacs-hook 'desktop-kill)
+(unless noninteractive
+  (add-hook 'kill-emacs-hook 'desktop-kill))

 (defun desktop-kill ()
   "If `desktop-save-mode' is non-nil, do what `desktop-save' says to do.

=== modified file 'lisp/emacs-lock.el'
--- lisp/emacs-lock.el	2011-01-25 04:08:28 +0000
+++ lisp/emacs-lock.el	2011-03-03 16:56:27 +0000
@@ -88,7 +88,8 @@
   (if emacs-lock-buffer-locked
       (setq emacs-lock-from-exiting t)))

-(add-hook 'kill-emacs-hook 'check-emacs-lock)
+(unless noninteractive
+  (add-hook 'kill-emacs-hook 'check-emacs-lock))
 (add-hook 'kill-buffer-hook 'emacs-lock-check-buffer-lock)
 (add-hook 'shell-mode-hook 'emacs-lock-was-buffer-locked)
 (add-hook 'shell-mode-hook 'emacs-lock-shell-sentinel)

=== modified file 'lisp/net/tramp-cache.el'
--- lisp/net/tramp-cache.el	2011-02-05 09:52:07 +0000
+++ lisp/net/tramp-cache.el	2011-03-03 16:48:37 +0000
@@ -353,7 +353,8 @@
 	  (write-region
 	   (point-min) (point-max) tramp-persistency-file-name))))))

-(add-hook 'kill-emacs-hook 'tramp-dump-connection-properties)
+(unless noninteractive
+  (add-hook 'kill-emacs-hook 'tramp-dump-connection-properties))
 (add-hook 'tramp-cache-unload-hook
 	  '(lambda ()
 	     (remove-hook 'kill-emacs-hook

=== modified file 'lisp/obsolete/fast-lock.el'
--- lisp/obsolete/fast-lock.el	2011-01-25 04:08:28 +0000
+++ lisp/obsolete/fast-lock.el	2011-03-03 16:46:59 +0000
@@ -840,7 +840,8 @@

 (add-hook 'after-save-hook 'fast-lock-save-cache-after-save-file)
 (add-hook 'kill-buffer-hook 'fast-lock-save-cache-before-kill-buffer)
-(add-hook 'kill-emacs-hook 'fast-lock-save-caches-before-kill-emacs)
+(unless noninteractive
+  (add-hook 'kill-emacs-hook 'fast-lock-save-caches-before-kill-emacs))

 ;;;###autoload
 (when (fboundp 'add-minor-mode)

=== modified file 'lisp/org/ob.el'
--- lisp/org/ob.el	2011-01-25 04:08:28 +0000
+++ lisp/org/ob.el	2011-03-03 16:46:31 +0000
@@ -1959,7 +1959,8 @@
        (message "Failed to remove temporary Org-babel directory %s"
 		org-babel-temporary-directory)))))

-(add-hook 'kill-emacs-hook 'org-babel-remove-temporary-directory)
+(unless noninteractive
+  (add-hook 'kill-emacs-hook 'org-babel-remove-temporary-directory))

 (provide 'ob)


=== modified file 'lisp/org/org-id.el'
--- lisp/org/org-id.el	2011-01-25 04:08:28 +0000
+++ lisp/org/org-id.el	2011-03-03 16:44:19 +0000
@@ -519,7 +519,8 @@
     (puthash id (abbreviate-file-name file) org-id-locations)
     (add-to-list 'org-id-files (abbreviate-file-name file))))

-(add-hook 'kill-emacs-hook 'org-id-locations-save)
+(unless noninteractive
+  (add-hook 'kill-emacs-hook 'org-id-locations-save))

 (defun org-id-hash-to-alist (hash)
   "Turn an org-id hash into an alist, so that it can be written to a file."

=== modified file 'lisp/progmodes/ps-mode.el'
--- lisp/progmodes/ps-mode.el	2011-01-26 08:36:39 +0000
+++ lisp/progmodes/ps-mode.el	2011-03-03 16:45:31 +0000
@@ -1162,7 +1162,8 @@

 \f
 ;;
-(add-hook 'kill-emacs-hook 'ps-run-cleanup)
+(unless noninteractive
+  (add-hook 'kill-emacs-hook 'ps-run-cleanup))

 (provide 'ps-mode)


=== modified file 'lisp/ps-print.el'
--- lisp/ps-print.el	2011-02-03 07:21:56 +0000
+++ lisp/ps-print.el	2011-03-03 16:52:22 +0000
@@ -6645,7 +6645,8 @@
 	 (error "Unprinted PostScript"))))

 (cond ((fboundp 'add-hook)
-       (funcall 'add-hook 'kill-emacs-hook 'ps-kill-emacs-check))
+       (unless noninteractive
+         (funcall 'add-hook 'kill-emacs-hook 'ps-kill-emacs-check)))
       (kill-emacs-hook
        (message "Won't override existing `kill-emacs-hook'"))
       (t

=== modified file 'lisp/saveplace.el'
--- lisp/saveplace.el	2011-01-25 04:08:28 +0000
+++ lisp/saveplace.el	2011-03-03 16:38:03 +0000
@@ -300,7 +300,8 @@

 (add-hook 'find-file-hook 'save-place-find-file-hook t)

-(add-hook 'kill-emacs-hook 'save-place-kill-emacs-hook)
+(unless noninteractive
+  (add-hook 'kill-emacs-hook 'save-place-kill-emacs-hook))

 (add-hook 'kill-buffer-hook 'save-place-to-alist)


=== modified file 'lisp/textmodes/reftex.el'
--- lisp/textmodes/reftex.el	2011-01-25 04:08:28 +0000
+++ lisp/textmodes/reftex.el	2011-03-03 16:45:48 +0000
@@ -2568,7 +2568,8 @@
 ;;; Install the kill-buffer and kill-emacs hooks ------------------------------

 (add-hook 'kill-buffer-hook 'reftex-kill-buffer-hook)
-(add-hook 'kill-emacs-hook  'reftex-kill-emacs-hook)
+(unless noninteractive
+  (add-hook 'kill-emacs-hook  'reftex-kill-emacs-hook))

 ;;; Run Hook ------------------------------------------------------------------


=== modified file 'lisp/textmodes/tex-mode.el'
--- lisp/textmodes/tex-mode.el	2011-01-28 21:16:04 +0000
+++ lisp/textmodes/tex-mode.el	2011-03-03 16:37:51 +0000
@@ -1990,7 +1990,8 @@
 	    (delete-file (concat dir (car list))))
           (setq list (cdr list))))))

-(add-hook 'kill-emacs-hook 'tex-delete-last-temp-files)
+(unless noninteractive
+  (add-hook 'kill-emacs-hook 'tex-delete-last-temp-files))

 ;;
 ;; Machinery to guess the command that the user wants to execute.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#8137: Requiring a file during bytecompilation runs that file's kill-emacs-hook.
  2011-03-03 17:18   ` Juanma Barranquero
@ 2011-03-05 20:24     ` Chong Yidong
  2011-03-05 22:34       ` Juanma Barranquero
  0 siblings, 1 reply; 10+ messages in thread
From: Chong Yidong @ 2011-03-05 20:24 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 8137

Juanma Barranquero <lekktu@gmail.com> writes:

> There's no obvious case (that I can see) designed for non-interactive
> use, so I'd say let's apply the change and see whether someone
> complains.

ps-run-cleanup and tex-delete-last-temp-files look legit; they delete
temporary files, and ought to DTRT noninteractively.  The rest of the
change looks fine to me, so go ahead.






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#8137: Requiring a file during bytecompilation runs that file's kill-emacs-hook.
  2011-03-05 20:24     ` Chong Yidong
@ 2011-03-05 22:34       ` Juanma Barranquero
  2011-03-05 23:58         ` Chong Yidong
  0 siblings, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2011-03-05 22:34 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 8137

On Sat, Mar 5, 2011 at 21:24, Chong Yidong <cyd@stupidchicken.com> wrote:

> ps-run-cleanup and tex-delete-last-temp-files look legit; they delete
> temporary files, and ought to DTRT noninteractively.

Isn't that also true for org-babel-remove-temporary-directory, from org/ob.el?

    Juanma





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#8137: Requiring a file during bytecompilation runs that file's kill-emacs-hook.
  2011-03-05 22:34       ` Juanma Barranquero
@ 2011-03-05 23:58         ` Chong Yidong
  2011-03-06  0:58           ` Juanma Barranquero
  0 siblings, 1 reply; 10+ messages in thread
From: Chong Yidong @ 2011-03-05 23:58 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 8137

Juanma Barranquero <lekktu@gmail.com> writes:

> On Sat, Mar 5, 2011 at 21:24, Chong Yidong <cyd@stupidchicken.com> wrote:
>
>> ps-run-cleanup and tex-delete-last-temp-files look legit; they delete
>> temporary files, and ought to DTRT noninteractively.
>
> Isn't that also true for org-babel-remove-temporary-directory, from
> org/ob.el?

Yes, I think so.






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#8137: Requiring a file during bytecompilation runs that file's kill-emacs-hook.
  2011-03-05 23:58         ` Chong Yidong
@ 2011-03-06  0:58           ` Juanma Barranquero
  0 siblings, 0 replies; 10+ messages in thread
From: Juanma Barranquero @ 2011-03-06  0:58 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 8137-done

OK, applied.

   Juanma





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-03-06  0:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-28  5:13 bug#8137: Requiring a file during bytecompilation runs that file's kill-emacs-hook Juanma Barranquero
2011-02-28  9:28 ` martin rudalics
2011-02-28 12:27   ` Juanma Barranquero
2011-02-28 14:14     ` martin rudalics
2011-02-28 17:23 ` Chong Yidong
2011-03-03 17:18   ` Juanma Barranquero
2011-03-05 20:24     ` Chong Yidong
2011-03-05 22:34       ` Juanma Barranquero
2011-03-05 23:58         ` Chong Yidong
2011-03-06  0:58           ` Juanma Barranquero

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.