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, eg

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

链接地址: http://www.djcxy.com/p/1006.html

上一篇: django过滤器图标只能匹配整个单词

下一篇: emacs有可能使Python etags变得更智能一些吗?