A good improvement. There's still a minor bug with IPython and moving up the stacks with C-c -. In the demo1.py example, pressing C-c - repeatedly goes up the stack until the
----> 1 demo1.f()
line is reached, at which point string-match says "wrong-type-argument stringp nil"; here's the backtrace:
At this point the cursor in the *IPython* buffer is sitting at the start of the "----> 1 demo1.f()" line. It's not much of a problem, because on pressing C-c - again, the mini-buffer reports, "Top of traceback".
>> Secondly, the SyntaxError exceptions in the IPython buffer don't get
>> matched. Pressing C-c - does nothing with the following:
>>
>> In [1]: import demo2
>> File "demo3.py", line 4
>> if a != 25
>> ^
>> SyntaxError: invalid syntax
>>
Works well for me!
>> One thing that would be very useful would be to limit the searching for exception reporting lines to the *last* set of exceptions. If you have a long Python or IPython session there will probably be several exceptions and pressing C-c - repeatedly, not only goes up the stack for the last exception, but then revisits the stack for the previous one, and so on until the beginning of the buffer is reached. I don't know if it's feasible to narrow the search just to the last exception.
This too works well for me with Python, but with IPython presssing C-c - repeatedly still goes back to previous stack traces. In case it helps, I've attached the contents my *IPython* buffer that does this.
Hi Andreas,
A good improvement. There's still a minor bug with IPython and moving up the stacks with C-c -. In the demo1.py example, pressing C-c - repeatedly goes up the stack until the
----> 1 demo1.f()
line is reached, at which point string-match says "wrong- type-argument stringp nil"; here's the backtrace:
Debugger entered--Lisp error: (wrong- type-argument stringp nil) match(" .+.pyc" nil) exeption- buffer (current-buffer)) (if (save-match-data ...) (progn ...) (setq line ... pos ... file ...)) (when (string-match ".+.pyc" file) (setq file ...)) (when (string= errwhere "Bottom") (goto-char pos)) (if (and file line) (if ... ... ...) (error "%s of traceback" errwhere))) exeption- buffer ...) (if ... ... ...) (when ... ...) (when ... ...) (if ... ... ...)) (goto-char orig) (error "%s of traceback" errwhere)) next-exception start buffer searchdir errwhere)) (if (not ...) (progn ... ... ... ... ...) (goto-char orig) (error "%s of traceback" errwhere))) line-re nil t) (if (save-match-data ...) (progn ... ...) (if ... ... ... ...))) line-re nil t) (if ... ... ...))) next-exception( bol "*IPython*" re-search-backward "Top") next-exception (quote bob) buffer (quote re-search-forward) "Top") (py-find- next-exception (quote bol) buffer (quote re-search-backward) "Top")) next-exception ... buffer ... "Top") (py-find- next-exception ... buffer ... "Top")) (if (string= start "BOTTOM") (py-find- next-exception ... buffer ... "Bottom") (py-find- next-exception ... buffer ... "Bottom"))) next-exception- prepare( up nil) exception( nil) interactively( py-up-exception nil nil)
string-
(if (string-match ".+.pyc" file) (progn (setq file ...)))
(when (string-match ".+.pyc" file) (setq file (substring file 0 -1)))
(progn (setq py-last-
(if (not (save-match-data ...)) (progn (setq py-last-
(if (save-match-data (eq ... origline)) (progn (forward-line ...) (py-find-
(if (funcall searchdir py-traceback-
(let ((orig ...) (origline ...) file line pos) (goto-char (py-point start)) (if (funcall searchdir py-traceback-
py-find-
(if (string= start "TOP") (py-find-
(if (eq direction (quote up)) (if (string= start "TOP") (py-find-
(let* ((name ...) (buffer ...)) (when buffer (set-buffer ...)) (switch-to-buffer (current-buffer)) (if (eq direction ...) (if ... ... ...) (if ... ... ...)))
py-find-
py-up-
call-
At this point the cursor in the *IPython* buffer is sitting at the start of the "----> 1 demo1.f()" line. It's not much of a problem, because on pressing C-c - again, the mini-buffer reports, "Top of traceback".
>> Secondly, the SyntaxError exceptions in the IPython buffer don't get
>> matched. Pressing C-c - does nothing with the following:
>>
>> In [1]: import demo2
>> File "demo3.py", line 4
>> if a != 25
>> ^
>> SyntaxError: invalid syntax
>>
Works well for me!
>> One thing that would be very useful would be to limit the searching for exception reporting lines to the *last* set of exceptions. If you have a long Python or IPython session there will probably be several exceptions and pressing C-c - repeatedly, not only goes up the stack for the last exception, but then revisits the stack for the previous one, and so on until the beginning of the buffer is reached. I don't know if it's feasible to narrow the search just to the last exception.
This too works well for me with Python, but with IPython presssing C-c - repeatedly still goes back to previous stack traces. In case it helps, I've attached the contents my *IPython* buffer that does this.
Thanks again.
Cheers,
Richard.