unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jules Tamagnan <jtamagnan@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 23609@debbugs.gnu.org, dgutov@yandex.ru
Subject: bug#23609: 25.0.92; Python eldoc freeze
Date: Fri, 27 May 2016 12:12:26 -0400	[thread overview]
Message-ID: <86lh2vo4yd.fsf@gmail.com> (raw)
In-Reply-To: <83d1o726si.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 27 May 2016 12:23:41 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Jules Tamagnan <jtamagnan@gmail.com>
>> Cc: Dmitry Gutov <dgutov@yandex.ru>,  23609@debbugs.gnu.org
>> 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.





  parent reply	other threads:[~2016-05-27 16:12 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24 15:34 bug#23609: 25.0.92; Python eldoc freeze Jules Tamagnan
2016-05-25  6:11 ` Andreas Röhler
2016-05-25 15:18   ` Jules Tamagnan
2016-05-25 15:33     ` Andreas Röhler
2016-05-26 15:52       ` Jules Tamagnan
2016-05-26 16:31         ` Eli Zaretskii
2016-05-26 16:37           ` Dmitry Gutov
2016-05-26 16:48             ` Eli Zaretskii
2016-05-26 17:13               ` Jules Tamagnan
2016-05-27  9:23                 ` Eli Zaretskii
2016-05-27 14:41                   ` Eli Zaretskii
2016-05-27 14:52                     ` Jules Tamagnan
2016-05-27 19:06                       ` Eli Zaretskii
2016-05-27 15:42                     ` Glenn Morris
2016-05-27 18:41                       ` Eli Zaretskii
2016-05-27 16:12                   ` Jules Tamagnan [this message]
2016-05-27 16:18                     ` Dmitry Gutov
2016-05-27 17:12                       ` Jules Tamagnan
2016-05-27 18:26                         ` Dmitry Gutov
2016-05-27 18:39                           ` Jules Tamagnan
2016-05-27 18:50                             ` Dmitry Gutov
2016-05-27 18:57                               ` Jules Tamagnan
2016-05-27 19:05                     ` Eli Zaretskii
2016-05-27 19:13                       ` Jules Tamagnan
2016-05-27 19:30                         ` Eli Zaretskii
2016-05-27 19:43                           ` Jules Tamagnan
2016-05-27 19:49                             ` Eli Zaretskii
2016-05-27 20:19                               ` Jules Tamagnan
2016-05-28  7:53                                 ` Eli Zaretskii
2016-05-31 17:35                                   ` Jules Tamagnan
2016-06-06 14:08                                     ` Jules Tamagnan
2016-06-06 15:15                                       ` Eli Zaretskii
2016-06-10  9:10                                       ` Eli Zaretskii
2016-05-27  6:09             ` Andreas Röhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86lh2vo4yd.fsf@gmail.com \
    --to=jtamagnan@gmail.com \
    --cc=23609@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).