all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Uday S Reddy <u.s.reddy@cs.bham.ac.uk>
Cc: 5924@debbugs.gnu.org
Subject: bug#5924: 23.1; accept-process-output switching current-buffer
Date: Mon, 12 Apr 2010 16:58:13 -0400	[thread overview]
Message-ID: <jwvk4scqtmy.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <19395.28879.546000.627509@gargle.gargle.HOWL> (Uday S. Reddy's message of "Mon, 12 Apr 2010 20:13:19 +0100")

>> I've just installed a change in the Emacs Bzr trunk so that the
>> current-buffer is preserved when running the Elisp code of process
>> filters and sentinels.  If you can try this code (or try the patch
>> below) to see if it fixes your problem, it would be helpful.
> Hi Stephan, thanks very much for the quick action on this.  I am a bit
> embarrassed because I have never done a build of Emacs.  And, I am
> going to be away for a few days.  So, it will take me a while to try
> it out.  Hope you don't mind.

No problem, of course.

> (defsubst vm-accept-process-output (process)
>   (let ((buf (current-buffer))
> 	(old-point-max (save-excursion
> 			 (switch-to-buffer candidate-buf)
> 			 (point-max))))
>     (accept-process-output process nil nil t)
>     (if (not (equal buf (current-buffer)))
> 	(if (and (equal (current-buffer) candidate-buf)
> 		 (not (= old-point-max (point-max))))
> 	    (debug "found output sent to %s: %s to %s"
> 		   (current-buffer) old-point-max (point-max))
> 	  (debug "found buffer changed to %s" (current-buffer))))))

[ Side note: please, please, pretty please, don't use switch-to-buffer:
the above code is not supposed to mess with windows, so you want to use
`set-buffer' instead, and actually in this case (with-current-buffer
candidate-buf (point-max)) is really the right way to write it since you
do not need to save any point&mark but only the current buffer. ]

> Since the JUST-THIS-ONE flag is passed in as t, it shouldn't insert
> anything anything in 'candidate-buf' (which was my guess as to where
> it would go).  But the backtrace shows that it went there.

Hmm... will have to dig into this one as well.


        Stefan






  reply	other threads:[~2010-04-12 20:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-10 21:23 bug#5924: 23.1; accept-process-output switching current-buffer Uday S Reddy
2010-04-11  2:54 ` Stefan Monnier
2010-04-11 12:22   ` Uday S Reddy
2010-04-11 16:30     ` Stefan Monnier
2010-04-12 19:13       ` Uday S Reddy
2010-04-12 20:58         ` Stefan Monnier [this message]
2010-04-12 19:39       ` Uday S Reddy
2010-05-20  9:50       ` Uday S Reddy
2010-05-24  0:07       ` Uday S Reddy
2010-05-24  2:04       ` Uday S Reddy
2010-07-23 22:36         ` Stefan Monnier
2011-09-18 20:16           ` Lars Magne Ingebrigtsen

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

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

  git send-email \
    --in-reply-to=jwvk4scqtmy.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=5924@debbugs.gnu.org \
    --cc=u.s.reddy@cs.bham.ac.uk \
    /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 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.