GNU bug report logs - #5924
23.1; accept-process-output switching current-buffer

Previous Next

Package: emacs;

Reported by: Uday S Reddy <u.s.reddy <at> cs.bham.ac.uk>

Date: Sat, 10 Apr 2010 21:25:02 UTC

Severity: normal

Tags: fixed

Fixed in version 24.1

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Uday S Reddy <u.s.reddy <at> cs.bham.ac.uk>
Cc: 5924 <at> debbugs.gnu.org
Subject: bug#5924: 23.1; accept-process-output switching current-buffer
Date: Sat, 24 Jul 2010 00:36:46 +0200
> I should take back my last couple of messages.  I had a timer task
> running (after 2 second delay) which was changing buffers.
> Unfortunately, this was getting scheduled to run during the other
> process's accept-process-output.  So, I had mistakenly put the blame
> on accept-process-output.

Thanks for the heads up.  BTW, could you try the patch below (including
byte-compiling the file and re-dumping Emacs since it's a preloaded
file), to see if it would have fixed your problem, even with the
offending timer?


        Stefan


PS: BTW, I recommend to stay away from set-buffer and always use
with-current-buffer instead ;-)


=== modified file 'lisp/emacs-lisp/timer.el'
--- lisp/emacs-lisp/timer.el	2010-01-13 08:35:10 +0000
+++ lisp/emacs-lisp/timer.el	2010-07-23 22:32:44 +0000
@@ -321,7 +321,11 @@
 	  ;; We do this after rescheduling so that the handler function
 	  ;; can cancel its own timer successfully with cancel-timer.
 	  (condition-case nil
-	      (apply (timer--function timer) (timer--args timer))
+              ;; Timer functions should not change the current buffer.
+              ;; If they do, all kinds of nasty surprises can happen,
+              ;; and it can be hellish to track down their source.
+              (save-current-buffer
+                (apply (timer--function timer) (timer--args timer)))
 	    (error nil))
 	  (if retrigger
 	      (setf (timer--triggered timer) nil)))





This bug report was last modified 13 years and 252 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.