bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5924: 23.1; accept-process-output switching current-buffer


From: Uday S Reddy
Subject: bug#5924: 23.1; accept-process-output switching current-buffer
Date: Mon, 12 Apr 2010 20:13:19 +0100

Stefan Monnier writes:

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

The trick I use for these kinds of asynchronous errors is to set error
traps that log entries whenever the unexpected situations occur.  Of
course, it is not easy to figure out what to log and several repeated
trials may be necessary to get enough diagnostic information.

> > So, it should have no reason to change the current-buffer to the other
> > process.  But it did.  I am not sure if the JUST-THIS-ONE flag is
> > doing anything at all.
> 
> I don't know of a bug in this regard, so if you have evidence that
> JUST-THIS-ONE doesn't prevent reading other process's output, please
> report it.

OK, I defined a wrappe around accept-process-output function as follows:

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

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.

Debugger entered: ("found output sent to %s: %s to %s" #<buffer saved IMAP 
localhost 19:59:10> 1019 1086)
  vm-imap-read-object(#<process IMAP<1>>)
  vm-imap-read-response(#<process IMAP<1>>)
  vm-imap-read-response-and-verify(#<process IMAP<1>> "size FETCH")
  vm-imap-get-message-size(#<process IMAP<1>> 3698)
  byte-code(...)
  vm-imap-synchronize-folder(t nil t t t t)
  vm-get-spooled-mail(t)
  vm-get-new-mail(nil)
  call-interactively(vm-get-new-mail nil nil)

Cheers,
Uday






reply via email to

[Prev in Thread] Current Thread [Next in Thread]