diff options
| author | Fabián Ezequiel Gallina | 2012-05-17 00:02:58 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2012-05-17 00:02:58 -0300 |
| commit | 9e6629387daaee10adb18baa892b4af58d2c5a33 (patch) | |
| tree | b238a91e2fe09761617215e23f409bb82ca38398 | |
| parent | ed0eb594649dbdfbf130c2b0d4e6297226258f87 (diff) | |
| download | emacs-9e6629387daaee10adb18baa892b4af58d2c5a33.tar.gz emacs-9e6629387daaee10adb18baa892b4af58d2c5a33.zip | |
Eldoc integration is now compatible with python 3
| -rw-r--r-- | lisp/progmodes/python.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index af441460562..739b137d566 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1413,14 +1413,19 @@ Optional argument JUSTIFY defines if the paragraph should be justified." | |||
| 1413 | "def __PYDOC_get_help(obj): | 1413 | "def __PYDOC_get_help(obj): |
| 1414 | try: | 1414 | try: |
| 1415 | import pydoc | 1415 | import pydoc |
| 1416 | obj = eval(obj, globals()) | 1416 | if hasattr(obj, 'startswith'): |
| 1417 | return pydoc.getdoc(obj) | 1417 | obj = eval(obj, globals()) |
| 1418 | doc = pydoc.getdoc(obj) | ||
| 1418 | except: | 1419 | except: |
| 1419 | return ''" | 1420 | doc = '' |
| 1421 | try: | ||
| 1422 | exec('print doc') | ||
| 1423 | except SyntaxError: | ||
| 1424 | print(doc)" | ||
| 1420 | "Python code to setup documentation retrieval.") | 1425 | "Python code to setup documentation retrieval.") |
| 1421 | 1426 | ||
| 1422 | (defvar python-eldoc-string-code | 1427 | (defvar python-eldoc-string-code |
| 1423 | "print __PYDOC_get_help('''%s''')\n" | 1428 | "__PYDOC_get_help('''%s''')\n" |
| 1424 | "Python code used to get a string with the documentation of an object.") | 1429 | "Python code used to get a string with the documentation of an object.") |
| 1425 | 1430 | ||
| 1426 | (defun python-eldoc-setup () | 1431 | (defun python-eldoc-setup () |