开发者

Is it possible to make Python etags a bit smarter with emacs?

I work on my Django project with emacs. In my virtualenv "postactivate" script I have the following simple command:

find -L . -type f -name "*.py" | xargs etags -e > /dev/null 2>&1 &

The TAGS file generates just fine but the system seems开发者_运维问答 rather dumb. When the cursor is a model filter call, e.g.

MyModel.objects.filter(...)

and I hit M-., sometimes emacs takes me place where MyModel is imported at the time of the file (the actual import statement). I only ever want to visit class, method, and function definitions.

Is there a way to make etags smarter?

Thanks, Ryan Kaskel


Getting correct module analysis with a language like python is very hard, due to his dynamic nature the best way to get correct information is doing static analysis or heuristics.

Currently the best I've found is exploring methods with the ropemacs extension that has great features like code assist (quite smart) and calltips.

Unfortunately it's not easy to get it right with ropemacs, you should install first pymacs and then configure install various rope libraries. (I'm working on a packaged version of it)

Another package that would statically analyze your python code and produce "smarter tags" would be something like pysmell, but I haven't used it extensively

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜