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)
2
  • Try looking here: stackoverflow.com/questions/10645401/emacs-python-mode Commented Dec 12, 2014 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. Commented Dec 12, 2014 at 19:56

1 Answer 1

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).

Sign up to request clarification or add additional context in comments.

5 Comments

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.
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.
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.
I don't see it here, but that doesn't mean what you see isn't real (or legit).
I just updated Emacs, and no longer have that problem. Thanks for your help, Stefan.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.