Show More
@@ -15,7 +15,7 b' details on the PSF (Python Software Foundation) standard license, see:' | |||
|
15 | 15 | |
|
16 | 16 | http://www.python.org/2.2.3/license.html |
|
17 | 17 | |
|
18 |
$Id: Debugger.py 1 |
|
|
18 | $Id: Debugger.py 1324 2006-05-24 20:25:11Z fperez $""" | |
|
19 | 19 | |
|
20 | 20 | #***************************************************************************** |
|
21 | 21 | # |
@@ -32,7 +32,6 b' $Id: Debugger.py 1029 2006-01-18 07:33:38Z fperez $"""' | |||
|
32 | 32 | # |
|
33 | 33 | #***************************************************************************** |
|
34 | 34 | |
|
35 | ||
|
36 | 35 | from IPython import Release |
|
37 | 36 | __author__ = '%s <%s>' % Release.authors['Fernando'] |
|
38 | 37 | __license__ = 'Python' |
@@ -63,7 +62,6 b' def _file_lines(fname):' | |||
|
63 | 62 | outfile.close() |
|
64 | 63 | return out |
|
65 | 64 | |
|
66 | ||
|
67 | 65 | class Pdb(pdb.Pdb): |
|
68 | 66 | """Modified Pdb class, does not load readline.""" |
|
69 | 67 | |
@@ -113,28 +111,23 b' class Pdb(pdb.Pdb):' | |||
|
113 | 111 | """Shorthand access to the color table scheme selector method.""" |
|
114 | 112 | self.color_scheme_table.set_active_scheme(scheme) |
|
115 | 113 | |
|
116 | ||
|
117 | 114 | def interaction(self, frame, traceback): |
|
118 | 115 | __IPYTHON__.set_completer_frame(frame) |
|
119 | 116 | pdb.Pdb.interaction(self, frame, traceback) |
|
120 | 117 | |
|
121 | ||
|
122 | 118 | def do_up(self, arg): |
|
123 | 119 | pdb.Pdb.do_up(self, arg) |
|
124 | 120 | __IPYTHON__.set_completer_frame(self.curframe) |
|
125 | 121 | do_u = do_up |
|
126 | 122 | |
|
127 | ||
|
128 | 123 | def do_down(self, arg): |
|
129 | 124 | pdb.Pdb.do_down(self, arg) |
|
130 | 125 | __IPYTHON__.set_completer_frame(self.curframe) |
|
131 | 126 | do_d = do_down |
|
132 | 127 | |
|
133 | ||
|
134 | 128 | def postloop(self): |
|
135 | 129 | __IPYTHON__.set_completer_frame(None) |
|
136 | 130 | |
|
137 | ||
|
138 | 131 | def print_stack_trace(self): |
|
139 | 132 | try: |
|
140 | 133 | for frame_lineno in self.stack: |
@@ -142,22 +135,20 b' class Pdb(pdb.Pdb):' | |||
|
142 | 135 | except KeyboardInterrupt: |
|
143 | 136 | pass |
|
144 | 137 | |
|
145 | ||
|
146 | 138 | def print_stack_entry(self,frame_lineno,prompt_prefix='\n-> ', |
|
147 | 139 | context = 3): |
|
148 | 140 | frame, lineno = frame_lineno |
|
149 | 141 | print >>Term.cout, self.format_stack_entry(frame_lineno, '', context) |
|
150 | 142 | |
|
151 | ||
|
152 | 143 | def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3): |
|
153 | 144 | import linecache, repr |
|
154 | 145 | |
|
155 |
ret = |
|
|
146 | ret = [] | |
|
156 | 147 | |
|
157 | 148 | Colors = self.color_scheme_table.active_colors |
|
158 | 149 | ColorsNormal = Colors.Normal |
|
159 | 150 | tpl_link = '%s%%s%s' % (Colors.filenameEm, ColorsNormal) |
|
160 |
tpl_call = ' |
|
|
151 | tpl_call = '%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal) | |
|
161 | 152 | tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal) |
|
162 | 153 | tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, |
|
163 | 154 | ColorsNormal) |
@@ -169,7 +160,7 b' class Pdb(pdb.Pdb):' | |||
|
169 | 160 | rv = frame.f_locals['__return__'] |
|
170 | 161 | #return_value += '->' |
|
171 | 162 | return_value += repr.repr(rv) + '\n' |
|
172 |
ret |
|
|
163 | ret.append(return_value) | |
|
173 | 164 | |
|
174 | 165 | #s = filename + '(' + `lineno` + ')' |
|
175 | 166 | filename = self.canonic(frame.f_code.co_filename) |
@@ -187,9 +178,10 b' class Pdb(pdb.Pdb):' | |||
|
187 | 178 | else: |
|
188 | 179 | args = '()' |
|
189 | 180 | call = tpl_call % (func, args) |
|
190 | ||
|
191 | level = '%s %s\n' % (link, call) | |
|
192 | ret += level | |
|
181 | ||
|
182 | # The level info should be generated in the same format pdb uses, to | |
|
183 | # avoid breaking the pdbtrack functionality of python-mode in *emacs. | |
|
184 | ret.append('> %s(%s)%s\n' % (link,lineno,call)) | |
|
193 | 185 | |
|
194 | 186 | start = lineno - 1 - context//2 |
|
195 | 187 | lines = linecache.getlines(filename) |
@@ -197,15 +189,13 b' class Pdb(pdb.Pdb):' | |||
|
197 | 189 | start = min(start, len(lines) - context) |
|
198 | 190 | lines = lines[start : start + context] |
|
199 | 191 | |
|
200 |
for i in |
|
|
201 | line = lines[i] | |
|
202 | if start + 1 + i == lineno: | |
|
203 | ret += self.__format_line(tpl_line_em, filename, start + 1 + i, line, arrow = True) | |
|
204 | else: | |
|
205 | ret += self.__format_line(tpl_line, filename, start + 1 + i, line, arrow = False) | |
|
206 | ||
|
207 | return ret | |
|
192 | for i,line in enumerate(lines): | |
|
193 | show_arrow = (start + 1 + i == lineno) | |
|
194 | ret.append(self.__format_line(tpl_line_em, filename, | |
|
195 | start + 1 + i, line, | |
|
196 | arrow = show_arrow) ) | |
|
208 | 197 | |
|
198 | return ''.join(ret) | |
|
209 | 199 | |
|
210 | 200 | def __format_line(self, tpl_line, filename, lineno, line, arrow = False): |
|
211 | 201 | bp_mark = "" |
@@ -242,7 +232,6 b' class Pdb(pdb.Pdb):' | |||
|
242 | 232 | line = tpl_line % (bp_mark_color + bp_mark, num, line) |
|
243 | 233 | |
|
244 | 234 | return line |
|
245 | ||
|
246 | 235 | |
|
247 | 236 | def do_list(self, arg): |
|
248 | 237 | self.lastcmd = 'list' |
@@ -1,5 +1,5 b'' | |||
|
1 | 1 | # -*- Mode: Shell-Script -*- Not really, but shows comments correctly |
|
2 |
# $Id: ipythonrc 1 |
|
|
2 | # $Id: ipythonrc 1324 2006-05-24 20:25:11Z fperez $ | |
|
3 | 3 | |
|
4 | 4 | #*************************************************************************** |
|
5 | 5 | # |
@@ -87,7 +87,7 b' autocall 1' | |||
|
87 | 87 | # a file with syntax errors in it. If this variable is true, IPython will ask |
|
88 | 88 | # you whether to re-open the editor immediately to correct such an error. |
|
89 | 89 | |
|
90 |
autoedit_syntax |
|
|
90 | autoedit_syntax 0 | |
|
91 | 91 | |
|
92 | 92 | # Auto-indent. IPython can recognize lines ending in ':' and indent the next |
|
93 | 93 | # line, while also un-indenting automatically after 'raise' or 'return'. |
@@ -6,7 +6,7 b' Requires Python 2.1 or better.' | |||
|
6 | 6 | |
|
7 | 7 | This file contains the main make_IPython() starter function. |
|
8 | 8 | |
|
9 |
$Id: ipmaker.py 1 |
|
|
9 | $Id: ipmaker.py 1324 2006-05-24 20:25:11Z fperez $""" | |
|
10 | 10 | |
|
11 | 11 | #***************************************************************************** |
|
12 | 12 | # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu> |
@@ -181,8 +181,8 b" object? -> Details about 'object'. ?object also works, ?? prints more." | |||
|
181 | 181 | # Set sensible command line defaults. |
|
182 | 182 | # This should have everything from cmdline_opts and cmdline_only |
|
183 | 183 | opts_def = Struct(autocall = 1, |
|
184 |
autoedit_syntax = |
|
|
185 | autoindent=0, | |
|
184 | autoedit_syntax = 0, | |
|
185 | autoindent = 0, | |
|
186 | 186 | automagic = 1, |
|
187 | 187 | banner = 1, |
|
188 | 188 | cache_size = 1000, |
@@ -1,5 +1,18 b'' | |||
|
1 | 1 | 2006-05-24 Fernando Perez <Fernando.Perez@colorado.edu> |
|
2 | 2 | |
|
3 | * ipython.el: fix the py-pdbtrack-input-prompt variable so that | |
|
4 | python-mode recognizes our debugger mode. | |
|
5 | ||
|
6 | * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of | |
|
7 | tracebacks when walking the stack so that the stack tracking system | |
|
8 | in emacs' python-mode can identify the frames correctly. | |
|
9 | ||
|
10 | * IPython/ipmaker.py (make_IPython): make the internal (and | |
|
11 | default config) autoedit_syntax value false by default. Too many | |
|
12 | users have complained to me (both on and off-list) about problems | |
|
13 | with this option being on by default, so I'm making it default to | |
|
14 | off. It can still be enabled by anyone via the usual mechanisms. | |
|
15 | ||
|
3 | 16 | * IPython/completer.py (Completer.attr_matches): add support for |
|
4 | 17 | PyCrust-style _getAttributeNames magic method. Patch contributed |
|
5 | 18 | by <mscott-AT-goldenspud.com>. Closes #50. |
@@ -6,7 +6,7 b'' | |||
|
6 | 6 | ;; URL: http://ipython.scipy.org |
|
7 | 7 | ;; Compatibility: Emacs21, XEmacs21 |
|
8 | 8 | ;; FIXME: #$@! INPUT RING |
|
9 |
(defconst ipython-version "$Revision: 1 |
|
|
9 | (defconst ipython-version "$Revision: 1324 $" | |
|
10 | 10 | "VC version number.") |
|
11 | 11 | |
|
12 | 12 | ;;; Commentary |
@@ -47,8 +47,8 b'' | |||
|
47 | 47 | ;; ------------------------- |
|
48 | 48 | ;; |
|
49 | 49 | ;; - IMO the best feature by far of the ipython/emacs combo is how much easier it |
|
50 |
;; makes it to find and fix bugs thanks to the `` |
|
|
51 |
;; it: first in the ipython to shell do `` |
|
|
50 | ;; makes it to find and fix bugs thanks to the ``%pdb on``/ pdbtrack combo. Try | |
|
51 | ;; it: first in the ipython to shell do ``%pdb on`` then do something that will | |
|
52 | 52 | ;; raise an exception (FIXME nice example) -- and be amazed how easy it is to |
|
53 | 53 | ;; inspect the live objects in each stack frames and to jump to the |
|
54 | 54 | ;; corresponding sourcecode locations as you walk up and down the stack trace |
@@ -177,7 +177,9 b' the second for a \'normal\' command, and the third for a multiline command.")' | |||
|
177 | 177 | (define-key py-shell-map [tab] 'ipython-complete) |
|
178 | 178 | ;;XXX this is really just a cheap hack, it only completes symbols in the |
|
179 | 179 | ;;interactive session -- useful nonetheless. |
|
180 |
(define-key py-mode-map [(meta tab)] 'ipython-complete) |
|
|
180 | (define-key py-mode-map [(meta tab)] 'ipython-complete) | |
|
181 | ||
|
182 | ) | |
|
181 | 183 | (add-hook 'py-shell-hook 'ipython-shell-hook) |
|
182 | 184 | ;; Regular expression that describes tracebacks for IPython in context and |
|
183 | 185 | ;; verbose mode. |
@@ -191,9 +193,13 b' the second for a \'normal\' command, and the third for a multiline command.")' | |||
|
191 | 193 | ;; (XXX: should ask Fernando for a change) |
|
192 | 194 | ;;"^ File \"\\(.*?\\)\", line \\([0-9]+\\).*\n.*\n.*\nSyntaxError:" |
|
193 | 195 | ;;^ File \"\\(.*?\\)\", line \\([0-9]+\\)" |
|
196 | ||
|
194 | 197 | (setq py-traceback-line-re |
|
195 | 198 | "\\(^[^\t ].+?\\.py\\).*\n +[0-9]+[^\00]*?\n-+> \\([0-9]+\\) +") |
|
196 | ||
|
199 | ||
|
200 | ;; Recognize the ipython pdb, whose prompt is 'ipdb>' instead of '(Pdb)' | |
|
201 | (setq py-pdbtrack-input-prompt "\n[(<]*[Ii]?[Pp]db[>)]+ ") | |
|
202 | ||
|
197 | 203 | (setq py-shell-input-prompt-1-regexp "^In \\[[0-9]+\\]: *" |
|
198 | 204 | py-shell-input-prompt-2-regexp "^ [.][.][.]+: *" ) |
|
199 | 205 | ;; select a suitable color-scheme |
General Comments 0
You need to be logged in to leave comments.
Login now