bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23609: 25.0.92; Python eldoc freeze


From: Jules Tamagnan
Subject: bug#23609: 25.0.92; Python eldoc freeze
Date: Fri, 27 May 2016 12:12:26 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.92 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: Jules Tamagnan <address@hidden>
>> Cc: Dmitry Gutov <address@hidden>,  address@hidden
>> Date: Thu, 26 May 2016 13:13:27 -0400
>> 
>> I've already filled out the proper paperwork and wouldn't mind doing
>> it. Would a timeout, of one second seem acceptable? If getting the
>> documentation takes longer than 1 second then it should timeout and we
>> should then locally set global-eldoc and eldoc mode to -1.
>
> Sorry, I'm not sure I'm following: what timeout are you talking about?
> (I've re-read the bug discussion, and there's no reference to any
> timeouts there, either.)
>
> Perhaps show a patch you had in mind, then your intent will be clear?
>
> Thanks.

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 5aeefe4..8f01ac9 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -4293,12 +4293,18 @@ python-eldoc--get-doc-at-point
         (unless (zerop (length docstring))
           docstring)))))
 
+(defvar-local python-eldoc-get-doc t
+  "If eldoc should be used to get the documentation automatically")
+
 (defun python-eldoc-function ()
   "`eldoc-documentation-function' for Python.
 For this to work as best as possible you should call
 `python-shell-send-buffer' from time to time so context in
 inferior Python process is updated properly."
-  (python-eldoc--get-doc-at-point))
+  (when python-eldoc-get-doc
+    (with-timeout (1
+                   (setq python-eldoc-get-doc nil))
+      (python-eldoc--get-doc-at-point))))
 
 (defun python-eldoc-at-point (symbol)
   "Get help on SYMBOL using `help'.

This patch adds the buffer local variable 'python-eldoc-get-doc which is
intially set to t but if eldoc takes longer than one second to fetch the
documentation then it will be set to nil. With the variable being nil,
eldoc will no longer try to automatically fetch the documentation. The
documentation can still be fetched with "C-cC-f". This avoids removing
global-eldoc mode and allows the user to manually fetch the
documentation while disabling the automatic fetching which causes the
unexpected freezing. If the user calls eldoc themselves then it can
still freeze but then thats their fault and they can press "C-g" to send
a keyboard interupt to their process. At least it won't freeze
spontaneously.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]