[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#5924: 23.1; accept-process-output switching current-buffer
From: |
Stefan Monnier |
Subject: |
bug#5924: 23.1; accept-process-output switching current-buffer |
Date: |
Mon, 12 Apr 2010 16:58:13 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
>> 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