unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
Cc: Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se>,
	emacs-devel@gnu.org
Subject: Re: python-mode patch
Date: Wed, 23 Aug 2006 20:12:42 +1200	[thread overview]
Message-ID: <17644.3578.470144.458380@kahikatea.snap.net.nz> (raw)
In-Reply-To: <2cd46e7f0608211127j5abfa74bp7e2dcd23ea33941d@mail.gmail.com>

 > 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))
  
- 
- \f
  (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

  reply	other threads:[~2006-08-23  8:12 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-10 10:43 python-mode patch Slawomir Nowaczyk
2006-08-10 11:22 ` Nick Roberts
2006-08-10 16:12   ` Slawomir Nowaczyk
2006-08-10 20:19   ` Richard Stallman
2006-08-20 19:53     ` Slawomir Nowaczyk
2006-08-20 20:31       ` Steven Huwig
2006-08-21  9:39         ` Slawomir Nowaczyk
2006-08-20 21:08       ` Edward O'Connor
2006-08-21  9:03         ` Piet van Oostrum
2006-08-21  9:39           ` Slawomir Nowaczyk
2006-08-21 17:57         ` Peter Lee
2006-08-22  1:31           ` Stefan Monnier
2006-08-22 19:40             ` Peter Lee
2006-08-22 20:07               ` Slawomir Nowaczyk
2006-08-22 20:31                 ` Peter Lee
2006-08-23 20:10                   ` Slawomir Nowaczyk
2006-09-09 19:48                     ` Stefan Monnier
2006-08-20 21:41       ` Nick Roberts
2006-08-21  9:39         ` Slawomir Nowaczyk
2006-08-20 22:33       ` Stefan Monnier
2006-08-21  9:39         ` Slawomir Nowaczyk
2006-08-21 15:58           ` Stefan Monnier
2006-08-21 11:13       ` Richard Stallman
2006-08-23 20:10         ` Slawomir Nowaczyk
2006-08-25  7:43           ` Richard Stallman
2006-08-25  8:11             ` David Kastrup
2006-08-25  8:26             ` Nick Roberts
2006-08-26 10:08               ` Richard Stallman
2006-09-26 21:56                 ` Nick Roberts
2006-09-27  3:41                   ` Stefan Monnier
2006-09-27  5:30                     ` Nick Roberts
2006-09-27  3:59                   ` Ken Manheimer
2006-09-28  2:13                     ` Richard Stallman
2006-08-25  7:43           ` Richard Stallman
2006-08-25 15:44             ` Slawomir Nowaczyk
2006-08-21 18:27       ` Ken Manheimer
2006-08-23  8:12         ` Nick Roberts [this message]
2006-08-23 15:03           ` Ken Manheimer
2006-08-24 19:08         ` Slawomir Nowaczyk
2006-08-24 22:06           ` Nick Roberts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17644.3578.470144.458380@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=emacs-devel@gnu.org \
    --cc=slawomir.nowaczyk.847@student.lu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).