unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: JD Smith <jdtsmith@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: accept-process-output throws
Date: Wed, 24 Nov 2021 14:38:09 +0200	[thread overview]
Message-ID: <834k81afv2.fsf@gnu.org> (raw)
In-Reply-To: <DB651285-E4C3-4F9D-8283-2BE381B140EE@gmail.com> (message from JD Smith on Wed, 24 Nov 2021 00:14:06 -0500)

> From: JD Smith <jdtsmith@gmail.com>
> Date: Wed, 24 Nov 2021 00:14:06 -0500
> Cc: emacs-devel@gnu.org
> 
> 
> 
> > On Nov 23, 2021, at 10:25 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > 
> > Is this in "emacs -Q"?  If so, how did you start the process, and what
> > do you have in the process-filter and process-sentinel functions for
> > this process?
> 
> This is in a customized inferior python mode (a comint-derived mode), running iPython as the process.   I discovered the issue with `python-shell-send-string-no-output', which adds its own pre-output-filter to accumulate and discard process output.  The no-output commands are being sent to the process from a post-command hook which kicks off a timer (to gather completion and syntax data).  The command results arrive promptly, but when the non-local exit occurs, they “escape" the pre-output filtering and show up in the buffer.  When this occurs, it is always as a result of the non-local exit of `accept-process-output’.  I’ve found the problem gets more severe when the PCH-launched timer's delay is very small (<0.1s), i.e. when commands are sent in quick succession while typing.
> 
> I do not have an emacs -Q demo of this but can look at creating one with the stock python-shell-mode.  In the meantime I’ve found that if I bind (inhibit-quit t), remove `with-local-quit' and specify a timeout in `accept-process-output' (to silence the warning about the blocking call), this entirely prevents the non-local exit.  But this I feel is more of a workaround than a solution, and I still do not understand the original problem.

In this kind of complicated situations, I usually find it much simpler
and more efficient to run under GDB with a breakpoint on Fsignal and
Fthrow.  Then, when one of these breaks, examine the backtrace to find
out which code exited non-locally.



  reply	other threads:[~2021-11-24 12:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23 20:36 accept-process-output throws JD Smith
2021-11-24  3:25 ` Eli Zaretskii
2021-11-24  5:14   ` JD Smith
2021-11-24 12:38     ` Eli Zaretskii [this message]
2021-11-27 14:31       ` JD Smith

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=834k81afv2.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jdtsmith@gmail.com \
    /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).