emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

compilation-finish-functions might be called with wrong buffer


From: Nikolaj Schumacher
Subject: compilation-finish-functions might be called with wrong buffer
Date: Mon, 21 May 2007 00:27:55 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (darwin)

Hello,

compilation-handle-exit does this:

  (with-no-warnings
    (if compilation-finish-function
      (funcall compilation-finish-function (current-buffer) msg)))
  (run-hook-with-args 'compilation-finish-functions (current-buffer) msg)))

However, `compilation-finish-function' might change the current buffer.
In fact, JDEE does this.  And while I think it probably shouldn't,
that's not stated anywhere.


regards,
Nikolaj Schumacher

diff -du 
/Users/nik/.emacs.d/backup/\!Applications\!Emacs.app\!Contents\!Resources\!share\!emacs\!22.1.50\!lisp\!progmodes\!compile.el.\~3\~
 
/Applications/Emacs.app/Contents/Resources/share/emacs/22.1.50/lisp/progmodes/compile.el
--- lisp/progmodes/compile.el   2007-05-16 17:43:57.000000000 +0200
+++ lisp/progmodes/compile.el   2007-05-21 00:04:44.000000000 +0200
@@ -1426,7 +1426,8 @@
                             process-status exit-status msg)
                  (cons msg exit-status)))
        (omax (point-max))
-       (opoint (point)))
+       (opoint (point))
+       (cur-buffer (current-buffer)))
     ;; Record where we put the message, so we can ignore it later on.
     (goto-char omax)
     (insert ?\n mode-name " " (car status))
@@ -1447,8 +1448,8 @@
        (goto-char opoint))
     (with-no-warnings
       (if compilation-finish-function
-         (funcall compilation-finish-function (current-buffer) msg)))
-    (run-hook-with-args 'compilation-finish-functions (current-buffer) msg)))
+         (funcall compilation-finish-function cur-buffer msg)))
+    (run-hook-with-args 'compilation-finish-functions cur-buffer msg)))
 
 ;; Called when compilation process changes state.
 (defun compilation-sentinel (proc msg)

Diff finished.  Mon May 21 00:04:48 2007

reply via email to

[Prev in Thread] Current Thread [Next in Thread]