From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lawrence Liu Newsgroups: gmane.emacs.devel Subject: Re: python: Let pdb tracking not kill buffers Date: Mon, 7 Oct 2019 12:33:17 +0800 Message-ID: References: <83a7af66fo.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000a63e6305944a8db5" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="175558"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Andrii Kolomoiets , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 07 06:33:58 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iHKic-000jYW-04 for ged-emacs-devel@m.gmane.org; Mon, 07 Oct 2019 06:33:58 +0200 Original-Received: from localhost ([::1]:40546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHKia-0001Ha-La for ged-emacs-devel@m.gmane.org; Mon, 07 Oct 2019 00:33:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53161) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHKiE-0001Gk-R2 for emacs-devel@gnu.org; Mon, 07 Oct 2019 00:33:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHKiD-0003FQ-Bu for emacs-devel@gnu.org; Mon, 07 Oct 2019 00:33:34 -0400 Original-Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]:36952) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iHKi9-0003DP-TJ; Mon, 07 Oct 2019 00:33:30 -0400 Original-Received: by mail-oi1-x236.google.com with SMTP id i16so10531559oie.4; Sun, 06 Oct 2019 21:33:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JG0G+Qf+w0kfIbey9Jka3zWUWfBAbnPmkNDVYZh+sh0=; b=tOYqxPOSx9S3GVKt/Gh9BMjZUeCpLXJlFLgAVqndDlWp4TYHhfGNhIjQRBOkkj+DUb 5PJ4HIO8oThlIm+Y4HQvDLNXqNZKeXQDCk1+503TZSOmsh/rw4VSyWqbNTWnih3b7KK4 Xn8jlQG5ouN0Nb3HYQMy2wKq3yQBF/QqH52FjwWc9wT9bdlyyxPv44duETO1hqDwmZVs kKzgIhtvaRovltk/IL6ajD5QMDl5O6EL7UaYv5BHm7ND8y08yM4NtMjXGcwpSl/EnIlL 1ACnxsnwxHNHxuwaZea2cST13VL9hfJzgiZgZzjmCvQGnqOu3XTVstfcyG4S8wa+IcF5 wQlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JG0G+Qf+w0kfIbey9Jka3zWUWfBAbnPmkNDVYZh+sh0=; b=K/vDJnGL4E/Q9JiChDnX9ZRLwrmj/RPNsgRm1uVW8Wo+5aHO08Xapmjyz4X3duXSsU tnECYjI6J65t3fy0TuBrEqwHHUa17BGgDIElW/hp+qf+v3ya5BGIjvZiL5/JJ3qZoiGs VhlETlv89dRDmnt7xLzHgQSJ0XvjxIFGIpI3XYy9aWbOXgxh2kFuOCsGZTb8iW6CYWMB GAyUx65cYVhFFy0s+7DpBQjm/izVsrfWeA7AhL4l5jMxzAChxUbD8edKF+5B4Pz20qlC UXzxMZHZsGaB7uRokfW9Sxq6hF3jB1893r3oC+IleOv45OzMpnIJTFOafTw9nzmInxal pbsA== X-Gm-Message-State: APjAAAXgYe0ZJvN6EJjuNAQgCkoGPwCnabAC8TUSOT88u2KQElrDPIe+ K0dtG/EWcIXDQWpAiozyJdmItjaieRn68tVjFI38IQ== X-Google-Smtp-Source: APXvYqy0eWw+KODTNZhnlJEQFBRVI1Gzduypsoe1wtjci1tbFDOzquZ76+OwPca///+7Qo4WF2PJ7AZzJ/+FzitISBc= X-Received: by 2002:aca:4f8f:: with SMTP id d137mr17164808oib.33.1570422808524; Sun, 06 Oct 2019 21:33:28 -0700 (PDT) In-Reply-To: <83a7af66fo.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240686 Archived-At: --000000000000a63e6305944a8db5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Dear I am a full time python developer and seems in my case mostly I am using the way as below: insert a import pdb; pdb.set_trace(); in my code bass and trigger the break point from other place (mostly browser) and wait for the break point been hit. Thanks. Eli Zaretskii =E4=BA=8E2019=E5=B9=B410=E6=9C=885=E6=97=A5 =E5= =91=A8=E5=85=AD14:41=E5=86=99=E9=81=93=EF=BC=9A > > From: Andrii Kolomoiets > > Date: Fri, 4 Oct 2019 23:32:09 +0300 > > > > 1. echo "import pdb; pdb.set_trace()" > test.py > > 2. emacs -Q > > 3. M-x run-python > > 4. M-x python-shell-send-file test.py > > > > Now there are two windows: one with pdb session and another one with > > source code. > > Now in pdb prompt: pass > > > > 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. > > Thanks. > > Aren't users supposed to use pdb via "M-x pdb" instead? (I don't use > this, and don't debug Python programs, so maybe my question makes no > sense.) > > > 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. > > Besides the question I asked above, your patch is too large to be > accepted without assigning copyright to the FSF. Would you like to > start the legal paperwork rolling, so that any contributions from you > could be accepted without limitations? > > > +(defcustom python-pdbtrack-continue-command '("c" "cont" "continue") > > + "Pdb continue command." > > + :type 'list > > + :group 'python) > > Each new defcustom should have a :version tag. Also, if they belong > to the group of the current file, our convention is not to use :group, > as that's redundant. > > In addition, please try making the doc strings explain how is the > variable used and what is its effect, including (if applicable) the > effect of special values, like nil etc. > > > +(defcustom python-pdbtrack-kill-buffers t > > + "Kill buffers when tracking is finished. > > +Only buffers opened during tracking will be killed." > > The first sentence should be "If non-nil, kill buffers when tracking > is finished." (And that is somewhat unclear, because it isn't clear > what it means "when tracking is finished".) > > -- Best Regards Lawrence --000000000000a63e6305944a8db5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Dear

I am a full time python developer and seems in my case mostly I a= m using the way as below:

insert a=C2=A0

import = pdb; pdb.set_trace();

in= my code bass and trigger the break point from other place (mostly browser)= and wait for the break point been hit.=C2=A0

Thanks.=C2=A0

<= div class=3D"gmail_quote">
Eli Zaretsk= ii <eliz@gnu.org>=E4=BA=8E2019=E5= =B9=B410=E6=9C=885=E6=97=A5 =E5=91=A8=E5=85=AD14:41=E5=86=99=E9=81=93=EF=BC= =9A
> From: Andrii Kolomoiets &l= t;andreyk.mad@gm= ail.com>
> Date: Fri, 4 Oct 2019 23:32:09 +0300
>
> 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 trac= king
> session is over.
>
> This behavior interferes with debug session. Moving frame up/down the<= br> > stack trace open new files but evaluating some code kill them when the= y
> are still needed.

Thanks.

Aren't users supposed to use pdb via "M-x pdb" instead?=C2=A0= (I don't use
this, and don't debug Python programs, so maybe my question makes no sense.)

> Attached patch brings the following changes:
>
> - New variable `python-pdbtrack-kill-buffers' that make buffers ki= lling
>=C2=A0 =C2=A0optional;
>
> - 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<= br> > not so good but they can be fine tuned later if the main idea will be<= br> > accepted.

Besides the question I asked above, your patch is too large to be
accepted without assigning copyright to the FSF.=C2=A0 Would you like to start the legal paperwork rolling, so that any contributions from you
could be accepted without limitations?

> +(defcustom python-pdbtrack-continue-command '("c" "= ;cont" "continue")
> +=C2=A0 "Pdb continue command."
> +=C2=A0 :type 'list
> +=C2=A0 :group 'python)

Each new defcustom should have a :version tag.=C2=A0 Also, if they belong to the group of the current file, our convention is not to use :group,
as that's redundant.

In addition, please try making the doc strings explain how is the
variable used and what is its effect, including (if applicable) the
effect of special values, like nil etc.

> +(defcustom python-pdbtrack-kill-buffers t
> +=C2=A0 "Kill buffers when tracking is finished.
> +Only buffers opened during tracking will be killed."

The first sentence should be "If non-nil, kill buffers when tracking is finished."=C2=A0 (And that is somewhat unclear, because it isn'= t clear
what it means "when tracking is finished".)

--
Best Regards
Lawrence
--000000000000a63e6305944a8db5--