emacs-devel
[Top][All Lists]
Advanced

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

python: Let pdb tracking not kill buffers


From: Andrii Kolomoiets
Subject: python: Let pdb tracking not kill buffers
Date: Fri, 4 Oct 2019 23:32:09 +0300

Hello,

Let's start from example:
1. echo "import pdb; pdb.set_trace()" > test.py
2. emacs -Q
3. M-x run-python
4. M-x python-shell-send-file <RET> test.py <RET>

Now there are two windows: one with pdb session and another one with
source code.
Now in pdb prompt: pass<RET>

The source code buffer is killed because pdb tracking comint output
filter doesn't found file name in the output and decides that tracking
session is over.

This behavior interferes with debug session. Moving frame up/down the
stack trace open new files but evaluating some code kill them when they
are still needed.

Another reason to not kill buffers is that I want the file opened during
debug session stay there when the debug session is over because I want
to change it.

My point is: it's hard to tell that debug session is over judging from
the output but it can be determined by inspecting the input.

Attached patch brings the following changes:

- New variable `python-pdbtrack-kill-buffers' that make buffers killing
  optional;

- Comint input filter which decides that the debug session is over;

- Process sentinel to finish tracking when python process is killed.

Please see attached patch. I certainly sure docstrings and naming are
not so good but they can be fine tuned later if the main idea will be
accepted.

Thanks.

Attachment: pdb-track.patch
Description: Binary data


reply via email to

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