]> git.eshelyaron.com Git - emacs.git/commitdiff
Eldoc setup code enhancements
authorFabián Ezequiel Gallina <galli.87@gmail.com>
Sat, 15 Nov 2014 18:50:30 +0000 (15:50 -0300)
committerFabián Ezequiel Gallina <galli.87@gmail.com>
Sat, 15 Nov 2014 18:50:30 +0000 (15:50 -0300)
Fixes: debbugs:18962
* lisp/progmodes/python.el (python-eldoc-setup-code): Enhance string
type checks, simplify printing.

lisp/ChangeLog
lisp/progmodes/python.el

index e2e535279c096c8a5b590c82f1c0982c2d93593a..5c7533f107336a1305dc0a33d03bf5171f6d63e8 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-15  Fabián Ezequiel Gallina  <fgallina@gnu.org>
+
+       * progmodes/python.el (python-eldoc-setup-code): Enhance string
+       type checks, simplify printing.  (Bug#18962)
+
 2014-11-14  Ivan Andrus  <darthandrus@gmail.com>
 
        * progmodes/python.el (python-shell-font-lock-kill-buffer):
index 2fcbe6430f2ffa57b123569acbec38ab8391905a..961aebeeecde16f3f657c5d661530d01f5c20ff6 100644 (file)
@@ -3546,7 +3546,11 @@ See `python-check-command' for the default."
   "def __PYDOC_get_help(obj):
     try:
         import inspect
-        if hasattr(obj, 'startswith'):
+        try:
+            str_type = basestring
+        except NameError:
+            str_type = str
+        if isinstance(obj, str_type):
             obj = eval(obj, globals())
         doc = inspect.getdoc(obj)
         if not doc and callable(obj):
@@ -3569,10 +3573,7 @@ See `python-check-command' for the default."
             doc = doc.splitlines()[0]
     except:
         doc = ''
-    try:
-        exec('print doc')
-    except SyntaxError:
-        print(doc)"
+    print (doc)"
   "Python code to setup documentation retrieval."
   :type 'string
   :group 'python)