0

So, as far as I understand it, when I M-x compile my python code, the Compilation buffer isn't really that easy to interact with as opposed to shell or ansi-term. So if I insert a pdb.set_trace() in my code, I can't debug in the Compilation buffer. However, what I do like about the Compilation buffer is that when I get the Traceback error I can navigate to all the problem files by just clicking or pressing enter on the referred problem files and even the line in said file.

I came across a blog post talking about enabling compilation-shell-minor-mode in the shell buffer, but that doesn't give me the ability to jump right to the offending file like I get when in the Compilation buffer. Is there any way I can enable that functionality in something like ansi-term? I say, ansi-term, because both the Compilation buffer and shell don't really work well with ipython's output for some reason.

EDIT: I added the code below, and now shell navigates the Traceback source code similar to the Compilation buffer. I believe it's the goto-address-mode that did the trick.

(add-hook 'shell-mode-hook 'compilation-shell-minor-mode)
(add-hook 'shell-mode-hook (lambda () (highlight-regexp "\\[OK\\]" "hi-green-b")))
(add-hook 'shell-mode-hook (lambda () (goto-address-mode )))
(require 'ansi-color)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
statmobile
  • 33
  • 3
  • Try looking here: http://stackoverflow.com/questions/10645401/emacs-python-mode – Dwight J. Browne Dec 12 '14 at 18:58
  • Actually, I use the elpy package for programming, this is more specific to running the entire Python library and following the Tracebacks. I just found my answer, and will post. – statmobile Dec 12 '14 at 19:56

1 Answers1

0

You might like to try C-u M-x compile which should give you the usual compilation buffer but with the difference that you can interact with it (it's using compint-mode).

Stefan
  • 27,908
  • 4
  • 53
  • 82
  • If I remember correctly, the C-u will disable precisely the feature I'm looking for which is to take me right to the line in the file in the Traceback. I think I figured it out. – statmobile Dec 12 '14 at 20:00
  • If th C-u stops the feature that makes you jump to the source when you click on an error message, then I'd recommend you report it via `M-x report-emacs-bug`. – Stefan Dec 12 '14 at 20:20
  • Would it be possible for you to confirm the same issue? Right now, I'm just happy that I found my workaround, but if this is legit I'll be more than happy to contribute by reporting the bug. – statmobile Dec 15 '14 at 04:11
  • I don't see it here, but that doesn't mean what you see isn't real (or *legit*). – Stefan Dec 15 '14 at 04:42
  • I just updated Emacs, and no longer have that problem. Thanks for your help, Stefan. – statmobile Jan 08 '15 at 01:41