unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [n_schumacher@web.de: compilation-finish-functions might be called with wrong buffer]
@ 2007-05-21 13:25 Richard Stallman
  2007-05-23  8:13 ` Glenn Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Stallman @ 2007-05-21 13:25 UTC (permalink / raw)
  To: emacs-devel

Would someone please install this in EMACS_22_BASE and the trunk?

------- Start of forwarded message -------
X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY 
	autolearn=failed version=3.1.0
To: emacs-pretest-bug@gnu.org
From: Nikolaj Schumacher <n_schumacher@web.de>
Date: Mon, 21 May 2007 00:27:55 +0200
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Subject: compilation-finish-functions might be called with wrong buffer

- --=-=-=

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


- --=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=emacs-compilation-handle-exit.patch
Content-Description: patch

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

- --=-=-=
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

- --=-=-=--
------- End of forwarded message -------

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

* Re: [n_schumacher@web.de: compilation-finish-functions might be called with wrong buffer]
  2007-05-21 13:25 [n_schumacher@web.de: compilation-finish-functions might be called with wrong buffer] Richard Stallman
@ 2007-05-23  8:13 ` Glenn Morris
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2007-05-23  8:13 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Richard Stallman wrote:

> Would someone please install this in EMACS_22_BASE and the trunk?

done

> From: Nikolaj Schumacher <n_schumacher@web.de>
> Subject: compilation-finish-functions might be called with wrong buffer
> To: emacs-pretest-bug@gnu.org
> Date: Mon, 21 May 2007 00:27:55 +0200

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

end of thread, other threads:[~2007-05-23  8:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-21 13:25 [n_schumacher@web.de: compilation-finish-functions might be called with wrong buffer] Richard Stallman
2007-05-23  8:13 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).