From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nick Roberts Newsgroups: gmane.emacs.devel Subject: Re: python-mode patch Date: Wed, 23 Aug 2006 20:12:42 +1200 Message-ID: <17644.3578.470144.458380@kahikatea.snap.net.nz> References: <17627.5883.285449.474785@kahikatea.snap.net.nz> <20060820214937.48E0.SLAWOMIR.NOWACZYK.847@student.lu.se> <2cd46e7f0608211127j5abfa74bp7e2dcd23ea33941d@mail.gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1156320935 20945 80.91.229.2 (23 Aug 2006 08:15:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 23 Aug 2006 08:15:35 +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 10:15:32 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 1GFntT-0007mL-Hw for ged-emacs-devel@m.gmane.org; Wed, 23 Aug 2006 10:15:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFntS-0001Eb-HN for ged-emacs-devel@m.gmane.org; Wed, 23 Aug 2006 04:15:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GFnt1-0001Bz-Ch for emacs-devel@gnu.org; Wed, 23 Aug 2006 04:14:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GFnsy-00019g-6T for emacs-devel@gnu.org; Wed, 23 Aug 2006 04:14:54 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFnsx-00019F-T2 for emacs-devel@gnu.org; Wed, 23 Aug 2006 04:14:51 -0400 Original-Received: from [202.37.101.8] (helo=viper.snap.net.nz) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GFo0k-000315-Ft for emacs-devel@gnu.org; Wed, 23 Aug 2006 04:22:55 -0400 Original-Received: from kahikatea.snap.net.nz (p202-124-124-18.snap.net.nz [202.124.124.18]) by viper.snap.net.nz (Postfix) with ESMTP id 3FA0A7B50B7; Wed, 23 Aug 2006 20:14:48 +1200 (NZST) Original-Received: by kahikatea.snap.net.nz (Postfix, from userid 500) id 6A312BE43C; Wed, 23 Aug 2006 20:12:44 +1200 (NZST) Original-To: "Ken Manheimer" In-Reply-To: <2cd46e7f0608211127j5abfa74bp7e2dcd23ea33941d@mail.gmail.com> X-Mailer: VM 7.19 under Emacs 22.0.50.4 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:58763 Archived-At: > 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. > 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. >... > 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. > 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 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 would also add a sentinel so e.g the overlay arrow is no longer displayed if the py-shell buffer is killed. How about the changes below? (this is from FC5, I don't know what version of python-mode that corresponds to). -- Nick http://www.inet.net.nz/~nickrob *** /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