Pull requests

#1 Open
Repository
tkf
Branch
default
Repository
jonwaltman
Branch
default

Add pydoc-info-current-symbol-function

Bitbucket cannot automatically merge this request.

The commits that make up this pull request have been removed.

Bitbucket cannot automatically merge this request due to conflicts.

Review the conflicts on the Overview tab. You can then either decline the request or merge it manually on your local system using the following commands:

hg update 
hg pull -r 68966ad9edc0 https://bitbucket.org/tkf/pydoc-info
Author
  1. Takafumi Arakaki
Reviewers
Description

As we discussed in issue #2, now pydoc-info-python-symbol-at-point can be modified using configurable variable pydoc-info-current-symbol-function.

Comments (1)

  1. Takafumi Arakaki author

    Other possible implementation is to provide pydoc-info-current-symbol-functions and allow list of functions. like this:

    (defun pydoc-info-current-symbol-python-el ()
      "Return current symbol.  Requires python.el."
      (when (featurep 'python)
        (with-syntax-table python-dotty-syntax-table
          (current-word))))
    
    (defun pydoc-info-current-symbol-python-mode-el ()
      "Return current symbol.  Requires python-mode.el."
      (when (featurep 'python-mode)
        ...))
    
    (setq pydoc-info-current-symbol-functions
          '(pydoc-info-current-symbol-python-el
            pydoc-info-current-symbol-python-mode-el))
    

    When user defines a better symbol function, he can simply do:

    (push 'my-better-current-symbol
          pydoc-info-current-symbol-functions)
    

    I prefer this because

    1. user does not have to configure pydoc-info-current-symbol-functions
    2. my-better-current-symbol does not have to provide fallback mechanism