From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: python: Let pdb tracking not kill buffers Date: Sat, 05 Oct 2019 09:40:43 +0300 Message-ID: <83a7af66fo.fsf@gnu.org> References: Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="93539"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Andrii Kolomoiets Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 05 08:41:44 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 1iGdl8-000ODM-Oe for ged-emacs-devel@m.gmane.org; Sat, 05 Oct 2019 08:41:42 +0200 Original-Received: from localhost ([::1]:54462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGdl6-0004l2-OF for ged-emacs-devel@m.gmane.org; Sat, 05 Oct 2019 02:41:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50377) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGdkN-0004kr-A3 for emacs-devel@gnu.org; Sat, 05 Oct 2019 02:40:56 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iGdkN-0007e6-6b; Sat, 05 Oct 2019 02:40:55 -0400 Original-Received: from [176.228.60.248] (port=4718 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iGdkM-00075c-DJ; Sat, 05 Oct 2019 02:40:54 -0400 In-reply-to: (message from Andrii Kolomoiets on Fri, 4 Oct 2019 23:32:09 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:240594 Archived-At: > 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".)