GNU bug report logs - #23609
25.0.92; Python eldoc freeze

Previous Next

Package: emacs;

Reported by: Jules Tamagnan <jtamagnan <at> gmail.com>

Date: Tue, 24 May 2016 15:36:01 UTC

Severity: normal

Found in version 25.0.92

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #99 received at 23609 <at> debbugs.gnu.org (full text, mbox):

From: Jules Tamagnan <jtamagnan <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: dgutov <at> yandex.ru, 23609 <at> debbugs.gnu.org
Subject: Re: bug#23609: 25.0.92; Python eldoc freeze
Date: Tue, 31 May 2016 13:35:27 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks.  We should try making the message text shorter, so it fits on
> a single line.
>
>> We could also perhaps make it such that if the timeout variable were
>> negative then instead of permanently stopping eldoc it would only
>> return, like you had suggested. A boolean defcustom could also be
>> used for that if we want.
>
> I don't see any significant advantage either way.
>
>> Also 'python-eldoc--get-doc' could be renamed to not be private if we
>> expect somebody to want to change it
>
> Yes, that variable should not be private if users are expected to set
> it.  Alternatively, we could add a simple command to set the variable
> non-nil, which might also help making the message text shorter.

I've improved the documentation, added the boolean to make the timeout
permanent and shortened the messages

index 5aeefe4..d555e21 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -4293,12 +4293,45 @@ python-eldoc--get-doc-at-point
         (unless (zerop (length docstring))
           docstring)))))

+(defvar-local python-eldoc-get-doc t
+  "Non-nil means eldoc should fetch the documentation
+  automatically. Set to nil by `python-eldoc-function' if
+  `python-eldoc-function-timeout-permanent' is non-nil and
+  `python-eldoc-function' times out.")
+
+(defcustom python-eldoc-function-timeout 1
+  "Timeout for `python-eldoc-function' in seconds."
+  :group 'python
+  :type 'integer)
+
+(defcustom python-eldoc-function-timeout-permanent t
+  "Non-nil means that when `python-eldoc-function' times out
+`python-eldoc-get-doc' will be set to nil"
+  :group 'python
+  :type 'boolean)
+
 (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))
+inferior Python process is updated properly.
+
+If `python-eldoc-function-timeout' seconds elapse before this
+function returns then if
+`python-eldoc-function-timeout-permanent' is non-nil
+`python-eldoc-get-doc' will be set to nil and eldoc will no
+longer return the documentation at the point automatically.
+
+Set `python-eldoc-get-doc' to t to reenable eldoc documentation
+fetching"
+  (when python-eldoc-get-doc
+    (with-timeout (python-eldoc-function-timeout
+                   (if python-eldoc-function-timeout-permanent
+                       (progn
+                         (message "Eldoc echo-area display muted in current buffer, see `python-eldoc-function'")
+                         (setq python-eldoc-get-doc nil))
+                     (message "`python-eldoc-function' timed out, see `python-eldoc-function-timeout'")))
+      (python-eldoc--get-doc-at-point))))

 (defun python-eldoc-at-point (symbol)
   "Get help on SYMBOL using `help'.




This bug report was last modified 8 years and 351 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.