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