unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
To: emacs-devel@gnu.org
Subject: [n_schumacher@web.de: compilation-finish-functions might be called with wrong buffer]
Date: Mon, 21 May 2007 09:25:09 -0400	[thread overview]
Message-ID: <E1Hq7sr-0000ws-8x@fencepost.gnu.org> (raw)

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 -------

             reply	other threads:[~2007-05-21 13:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-21 13:25 Richard Stallman [this message]
2007-05-23  8:13 ` [n_schumacher@web.de: compilation-finish-functions might be called with wrong buffer] Glenn Morris

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=E1Hq7sr-0000ws-8x@fencepost.gnu.org \
    --to=rms@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 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).