From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jules Tamagnan Newsgroups: gmane.emacs.bugs Subject: bug#23609: 25.0.92; Python eldoc freeze Date: Fri, 27 May 2016 16:19:57 -0400 Message-ID: <86shx3w8wi.fsf@gmail.com> References: <867fejo4g2.fsf@gmail.com> <57454201.10607@easy-emacs.de> <86bn3umahs.fsf@gmail.com> <5745C5D9.50701@easy-emacs.de> <861t4orf3h.fsf@gmail.com> <834m9k3hmz.fsf@gnu.org> <83wpmg229w.fsf@gnu.org> <86mvncpwso.fsf@gmail.com> <83d1o726si.fsf@gnu.org> <86lh2vo4yd.fsf@gmail.com> <83inxzz5ha.fsf@gnu.org> <86a8jbxqjd.fsf@gmail.com> <83fut3z4bq.fsf@gnu.org> <861t4nxp61.fsf@gmail.com> <83d1o7z3gm.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1464380558 14034 80.91.229.3 (27 May 2016 20:22:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 May 2016 20:22:38 +0000 (UTC) Cc: 23609@debbugs.gnu.org, dgutov@yandex.ru To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 27 22:22:26 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b6OH3-0006Rq-0w for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 May 2016 22:22:25 +0200 Original-Received: from localhost ([::1]:47747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6OH2-00025B-Bi for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 May 2016 16:22:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6OFl-0001N2-Ai for bug-gnu-emacs@gnu.org; Fri, 27 May 2016 16:21:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6OFi-0005ZY-1e for bug-gnu-emacs@gnu.org; Fri, 27 May 2016 16:21:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58805) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6OFh-0005ZU-UH for bug-gnu-emacs@gnu.org; Fri, 27 May 2016 16:21:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1b6OFh-0006Mk-Ol for bug-gnu-emacs@gnu.org; Fri, 27 May 2016 16:21:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jules Tamagnan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 May 2016 20:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23609 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23609-submit@debbugs.gnu.org id=B23609.146438040624399 (code B ref 23609); Fri, 27 May 2016 20:21:01 +0000 Original-Received: (at 23609) by debbugs.gnu.org; 27 May 2016 20:20:06 +0000 Original-Received: from localhost ([127.0.0.1]:42909 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b6OEo-0006LS-49 for submit@debbugs.gnu.org; Fri, 27 May 2016 16:20:06 -0400 Original-Received: from mail-qk0-f175.google.com ([209.85.220.175]:36703) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b6OEm-0006Kt-M0 for 23609@debbugs.gnu.org; Fri, 27 May 2016 16:20:04 -0400 Original-Received: by mail-qk0-f175.google.com with SMTP id x7so87244155qkd.3 for <23609@debbugs.gnu.org>; Fri, 27 May 2016 13:20:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=z3YOqwyxalJPBb6e5VjO08jIKqvOqhbJB8pg5+7bNPQ=; b=eH57HiMrWzj4GgeV1jrly+aEC7WadCUCw2QdvoBufckfS++cUSfG/W99hM8YFdqGQl jmxYIKmXURuLHOigTnMwkVoY9vxA+bc7PF313458HHPunbRlS/j8ctfPya1wzmEHpgvS Zu51AdKKK+yYdBxbNEk6jhrSqqElI9dpQteiH+WZVJCnFoDLocotwLP+V7ZrFDLThID3 adLOi7YsFHP/eWpPd8LLnPbnzN3XFAo1a6Rw0jWzjclz2mfJLQuyyj8Jg5c9SrMQF4tr T4KHzDy+OpRuGjXkRH+BX+EEGnnycuESfGKrjby4T0A2nCpYQYxrsidE/4mkKvYd7+g+ jXYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=z3YOqwyxalJPBb6e5VjO08jIKqvOqhbJB8pg5+7bNPQ=; b=lT9ez1fMhLNwIB+O1kafJHwmKnc+ZFJTr5d8I+i08hKiw7SmJLYpRlRRaCkcpFG0ar JD7yvi1wFoxVxogVmUheKWJcOs5y96/5iUDscjWQSG5BO0Xc1s74TeIwfOFkhK2XdP4o l6PZ2zqVkQuCeEu2qO9b5j/Qa9pvunMTTw73+tnibCuqHhNkXaFyDYCVsrqiIvihj0kF Y9nZxhV3VXqMW3gWO3zSBmvEMP46mcpLWStd1mDvsJ2VMVLsZ0ZzCatMoqHhyRGRIepP a93iitmEEbDlcfo47oWzSX3XGh3hfy6PLUKZVuuWUKK9rSdpNPyg8nRIWyu2Nebn1Uxi JBRw== X-Gm-Message-State: ALyK8tLmnSUkUPnWoN28TvFTV5/n2LTsaOVWmKu5Z/KX18THHRTeL9D1SWZrc/evVHZutw== X-Received: by 10.200.47.6 with SMTP id j6mr15566996qta.85.1464380399314; Fri, 27 May 2016 13:19:59 -0700 (PDT) Original-Received: from bandersnatch ([130.132.236.142]) by smtp.gmail.com with ESMTPSA id j5sm3053301qge.0.2016.05.27.13.19.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 May 2016 13:19:58 -0700 (PDT) In-Reply-To: <83d1o7z3gm.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 27 May 2016 22:49:13 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.92 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:118787 Archived-At: Eli Zaretskii writes: >> From: Jules Tamagnan >> Cc: 23609@debbugs.gnu.org, dgutov@yandex.ru >> Date: Fri, 27 May 2016 15:43:18 -0400 >> >> > Once again, perhaps I misunderstand the nature of the problem, but >> > doesn't it happen only when the Python interpreter is busy doing >> > something when the eldoc function is invoked? If so, then the next >> > time eldoc is invoked, the Python interpreter might not be busy, and >> > the feature will work without hanging, right? Or am I missing >> > something? >> >> No that's exactly correct. I'm just thinking of it from the point of >> view that perhaps somebody is plotting a graph from the interpreter >> which causes the interpreter to be busy. Then while having that graph >> open they would still like to be able to edit their code (I have been in >> this situation dozens of times). Or if the code they are running takes a >> a minute or two there is a good chance that they would want to edit some >> of the code while it is running. In those scenarios I feel like it makes >> sense to stop eldoc from doing the automatic checking permanently for >> that buffer because otherwise my work would be constantly interrupted. > > OK, so let's go with your suggestion, but make that message we agreed > should be added say something like > > ElDoc mode echo-area display turned off; type .... to turn on > > where "..." stands for whatever needs to be done to turn it back on > again. > > Also, I do think a defcustom is due instead of a hardwired constant of > 1 sec. > > Could you please augment your patch along these lines? > > Thanks. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 5aeefe4..46c3bd9 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -4293,12 +4293,29 @@ 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") + +(defcustom python-eldoc-function-timeout 1 + "Timeout for python-eldoc-function in seconds." + :group 'python + :type 'integer) + (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 `python-eldoc--get-doc' will be set to nil +and eldoc will no longer return the documentation at the point +automatically." + (when python-eldoc--get-doc + (with-timeout (python-eldoc-function-timeout + (message "Eldoc mode echo-area display turned off in current buffer; eval (setq python-eldoc--get-doc t) to turn on") + (setq python-eldoc--get-doc nil)) + (python-eldoc--get-doc-at-point)))) (defun python-eldoc-at-point (symbol) "Get help on SYMBOL using `help'. Here was my rendition of the task at hand. 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. Also 'python-eldoc--get-doc' could be renamed to not be private if we expect somebody to want to change it Thanks