简体   繁体   English

Emacs:使用pdbtrack(python.el)

[英]Emacs: using pdbtrack (python.el)

I've been studying Emacs as a Python IDE. 我一直在研究Emacs作为Python IDE。 There's an excellent, up-to-date solution: emacs-for-python by Gabriele Lanar. 有一个出色的最新解决方案:Gabriele Lanar的emacs-for-python。 Unfortunately, I can't employ pdbtrack. 不幸的是,我不能雇用pdbtrack。 That is, dropping into pdb I am not shown Python source buffer with a cursor at the current line, etc. The only way to make it sort of work is this ugly hack: http://page.sourceforge.net/tricks.html#Running_pdb_under_emacs Moreover, Gud probably has never been the way to go with an interpreted language like Python: (hyperlink not allowed) There's one discussion, https://github.com/fgallina/python.el/issues/43 , but it leads nowhere. 也就是说,放入pdb时,我没有在光标所在的行等处看到Python源缓冲区,而使它工作的唯一方法是这种难看的hack: http : //page.sourceforge.net/tricks.html #Running_pdb_under_emacs而且,Gud可能从来没有采用像Python这样的解释语言的方式:(不允许超链接)有一个讨论, https://github.com/fgallina/python.el/issues/43 ,但是它导致无处。 I've also discovered python-pdbtrack-activate variable, but it's set to t by default anyway. 我还发现了python-pdbtrack-activate变量,但是无论如何它默认设置为t。 There's one word of hope: "BTW it should be possible to add the pdbtrack filter function globally, but haven't tested and I don't think I would activate such thing by default". 有一个希望的词:“顺便说一句,应该有可能在全球范围内添加pdbtrack过滤器功能,但是尚未经过测试,而且我认为默认情况下不会激活此类功能”。 Why, I don't mind such thing being inactive by default, I'd just like to know how to turn it on... The ability to drop into the debugger via pdb.set_trace() as nicely as possible is essential, IMO. 为什么,我不介意这种事情默认情况下是不活动的,我只是想知道如何打开它……尽可能好地通过pdb.set_trace()进入调试器的功能是必不可少的,IMO 。 I hope it's possible right now. 我希望现在有可能。

This is not an answer to your precise question, but it solves your issue as well. 这不是您的确切问题的答案,但它也可以解决您的问题。 I use pdb++ inside emacs' term mode: pdb++'s "sticky mode" gives me the equivalent of pdbtrack, with the advantage that it doesn't have to open a buffer for each file it visits (because it simply displays the source code in the term buffer). 我在emacs的术语模式内使用pdb ++ :pdb ++的“粘滞模式”使我等效于pdbtrack,其优点是不必为它访问的每个文件打开缓冲区(因为它只是在术语中显示源代码)缓冲)。

As an additional bonus, I also get colorful tab completion as the pdb++ prompt :-) 作为额外的好处,我还可以通过pdb ++提示符获得丰富多彩的制表符完成:-)

If you use py.test, you might want to check also my pytest-emacs , which automatically starts py.test in a term buffer so that pdb works out of the box. 如果使用py.test,则可能还需要检查我的pytest-emacs ,它会自动在术语缓冲区中启动py.test,以便pdb可以立即使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM