Issue #4 new

pydoc-info changes python buffer major mode

Alexis Roda
created an issue

I use python-mode instead of the builtin python mode, Emacs 24.3.1.

When I lookup a symbol the buffer's major mode gets switched from python-mode mode to python mode and from this point on any python file will be opened in python mode.

The problem is caused by pydoc-info-python-symbol-at-point requiring 'python explicitly, which loads python.el rebinding the python-mode function.

Here's my quick and dirty hack in order to make pydoc-info work with my setup:

(defun pydoc-info-python-symbol-at-point ()
  "Return the current Python symbol."
      (cond ((boundp 'py-dotty-syntax-table)
             py-dotty-syntax-table)     ; python-mode
            ((boundp 'python-dotty-syntax-table)
             python-dotty-syntax-table) ; builtin python
            (t                          ; none available
             (require 'python)          ; load python

Comments (0)

  1. Log in to comment