From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Ken Manheimer" Newsgroups: gmane.emacs.devel Subject: Re: python-mode patch Date: Wed, 23 Aug 2006 11:03:30 -0400 Message-ID: <2cd46e7f0608230803x16aa4fecx76bcebec53b63d80@mail.gmail.com> References: <17627.5883.285449.474785@kahikatea.snap.net.nz> <20060820214937.48E0.SLAWOMIR.NOWACZYK.847@student.lu.se> <2cd46e7f0608211127j5abfa74bp7e2dcd23ea33941d@mail.gmail.com> <17644.3578.470144.458380@kahikatea.snap.net.nz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1156345467 10148 80.91.229.2 (23 Aug 2006 15:04:27 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 23 Aug 2006 15:04:27 +0000 (UTC) Cc: Slawomir Nowaczyk , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 23 17:04:20 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GFuGo-0007vd-Ub for ged-emacs-devel@m.gmane.org; Wed, 23 Aug 2006 17:03:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFuGo-0000j5-Ae for ged-emacs-devel@m.gmane.org; Wed, 23 Aug 2006 11:03:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GFuGU-0000ej-5V for emacs-devel@gnu.org; Wed, 23 Aug 2006 11:03:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GFuGS-0000c1-Ui for emacs-devel@gnu.org; Wed, 23 Aug 2006 11:03:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFuGS-0000bS-EX for emacs-devel@gnu.org; Wed, 23 Aug 2006 11:03:32 -0400 Original-Received: from [64.233.182.185] (helo=nf-out-0910.google.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GFuOI-0005gq-U5 for emacs-devel@gnu.org; Wed, 23 Aug 2006 11:11:39 -0400 Original-Received: by nf-out-0910.google.com with SMTP id q29so362766nfc for ; Wed, 23 Aug 2006 08:03:30 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ev56aTzpObiFe110sGJnxDNXs9tkfCLn6Z9Nm5ZmRSlx5G3GHmDdGG7GIsmDlNHRqnOqSN6UFs2EVGvvkHmkmHCZHCkXSQ+8o15eTDWCN1XPTjNyhEyit3U8IcRXxDEr+dpmlwZS5m+B/pN+xirodWB9z7++PqV9G4JXGhj7JLk= Original-Received: by 10.49.75.2 with SMTP id c2mr2094179nfl; Wed, 23 Aug 2006 08:03:30 -0700 (PDT) Original-Received: by 10.78.144.19 with HTTP; Wed, 23 Aug 2006 08:03:30 -0700 (PDT) Original-To: "Nick Roberts" In-Reply-To: <17644.3578.470144.458380@kahikatea.snap.net.nz> Content-Disposition: inline X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:58771 Archived-At: On 8/23/06, Nick Roberts wrote: > > the other python-mode, python-mode.el, has one feature that i would > > love (and need) to see in any python-mode before switching. (like > > others, i didn't know about the python-mode that comes with emacs 22, > > and i haven't tried it.) i originally developed it as "pdbtrack", and > > barry warsaw integrated it with python-mode.el. > > I think it would be good to add this especially as it is so few lines > of code. particularly when useful... > > what it does is add a comint-output-filter-function which looks for > > the prompts from python's interactive debugger, pdb. > > Yes. I think these hooks should be local as they interfere with other > comint derived buffers like shell, GUD etc. agreed - didn't know about qualifying hooks as local, at the time. (they're incredibly useful.) > > 150 lines of code (apparently 156, now) only gets the very basic > > pdb-session file/line tracking. you type debugging commands at the > > interpreter, there are no provisions for setting breakpoints in a > > screen-oriented manner, etc - but file/line tracking is 9/10 of the > > value of a screen-oriented debugger, for me, and the interpreter is > > quite manageable for the other 1/10. i'd prefer if this approach were > > extended to do the other stuff , but at least would like to see it > > incorporated with python.el's python-mode. > > It seems to me that most Python developers prefer it to pdb in gud.el but > I see no reason why they shouldn't work alongside one another. i don't disagree at all about enabling pdbtrack and gud to coexist. i've seen some discussion about revamping gud (after the emacs 22 release), and have wanted to alert those concerned to a substantially different approach, which migh yield better results - or might not, but is worth considering. however gud's job is done, enabling them to coexist is good. (i think for many python developers, me included, pdb in gud is not an option, because it means leaving the environment at the point where you want/need to do the debugging and somehow recreating it in a new gud / python session. i mention this because this quandry is not obvious until you're actually in the situation, but the situation is the common one for an interaction-oriented interpreted environment like python's. ironically, it's much like lisp in this way - hence, emacs has edebug, debug-on-error, edebug-on-error, etc, so you can start to debug when the bugs occur. i suspect the pdbtrack approach would be eminently suited for inferior lisp processes, as well...) > > if you're interested in scoping it out, look for variables and > > functions that contain the string pdbtrack". i suspect most of it can > > be used exactly as is. > > > > at 150 lines of code, and since i wrote the original, i would be happy > > to sign papers for it. > > Presumably you've already signed papers for Emacs as you have contributed > allout.el. i don't recall whether the signoff i've done applies to any contributions - i think i had to sign another for icomplete, for instance. > I find the PDB string in the mode-line too intrusive. If it's needed, perhaps > it could be a real minor-mode in the py-shell buffer. i haven't noticed that in a while (and haven't had the opportunity to write python for a while), will take a look. > I would also add a sentinel so e.g the overlay arrow is no longer displayed > if the py-shell buffer is killed. that sounds good. > How about the changes below? (this is from FC5, I don't know what version > of python-mode that corresponds to). these are good suggestions - i'll look at them soon, see about incorporating them into python-mode.el, and including them in the suggestions if someone works it all into python.el. tnx! -- ken ken.manheimer@gmail.com http://myriadicity.net > *** /usr/share/emacs/site-lisp/python-mode.el 2006-03-08 01:12:21.000000000 +1300 > --- /home/nickrob/lisp/python-mode.el 2006-08-23 20:08:47.000000000 +1200 > *************** > *** 271,281 **** > :group 'python) > (make-variable-buffer-local 'py-pdbtrack-do-tracking-p) > > - (defcustom py-pdbtrack-minor-mode-string " PDB" > - "*String to use in the minor mode list when pdbtrack is enabled." > - :type 'string > - :group 'python) > - > ;; Not customizable > (defvar py-master-file nil > "If non-nil, execute the named file instead of the buffer's file. > --- 271,276 ---- > *************** > *** 1298,1308 **** > (switch-to-buffer-other-window > (apply 'make-comint py-which-bufname py-which-shell nil args)) > (make-local-variable 'comint-prompt-regexp) > (setq comint-prompt-regexp "^>>> \\|^[.][.][.] \\|^(pdb) ") > (add-hook 'comint-output-filter-functions > ! 'py-comint-output-filter-function) > ;; pdbtrack > ! (add-hook 'comint-output-filter-functions 'py-pdbtrack-track-stack-file) > (setq py-pdbtrack-do-tracking-p t) > (set-syntax-table py-mode-syntax-table) > (use-local-map py-shell-map) > --- 1293,1305 ---- > (switch-to-buffer-other-window > (apply 'make-comint py-which-bufname py-which-shell nil args)) > (make-local-variable 'comint-prompt-regexp) > + (set-process-sentinel (get-buffer-process (current-buffer)) 'py-sentinel) > (setq comint-prompt-regexp "^>>> \\|^[.][.][.] \\|^(pdb) ") > (add-hook 'comint-output-filter-functions > ! 'py-comint-output-filter-function nil t) > ;; pdbtrack > ! (add-hook 'comint-output-filter-functions > ! 'py-pdbtrack-track-stack-file nil t) > (setq py-pdbtrack-do-tracking-p t) > (set-syntax-table py-mode-syntax-table) > (use-local-map py-shell-map) > *************** > *** 3245,3258 **** > > ;; arrange to kill temp files when Emacs exists > (add-hook 'kill-emacs-hook 'py-kill-emacs-hook) > - (add-hook 'comint-output-filter-functions 'py-pdbtrack-track-stack-file) > > ! ;; Add a designator to the minor mode strings > ! (or (assq 'py-pdbtrack-minor-mode-string minor-mode-alist) > ! (push '(py-pdbtrack-is-tracking-p py-pdbtrack-minor-mode-string) > ! minor-mode-alist)) > > - > - > (provide 'python-mode) > ;;; python-mode.el ends here > --- 3242,3250 ---- > > ;; arrange to kill temp files when Emacs exists > (add-hook 'kill-emacs-hook 'py-kill-emacs-hook) > > ! (defun py-sentinel (proc msg) > ! (setq overlay-arrow-position nil)) > > (provide 'python-mode) > ;;; python-mode.el ends here