summaryrefslogtreecommitdiff
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-06-19 00:47:00 +0200
committerPaul Eggert <eggert@cs.ucla.edu>2016-06-19 00:47:00 +0200
commit68cb71c0928eb8b10487a125192f43923e8bfe7f (patch)
tree053133358af1bd991d60ed6c29590ad84b29fed0 /lisp/progmodes/python.el
parent87c9d8fcec183c8f4933e218c1895b6a0722b1e1 (diff)
parent9ae514a9b7ed368ea97ddefa806079b6423833cb (diff)
downloademacs-68cb71c0928eb8b10487a125192f43923e8bfe7f.tar.gz
Merge from origin/emacs-25
9ae514a * etc/AUTHORS: Update the AUTHORS file 3ca428e add entries to authors.el 66d556b Fix eldoc-related freezes in python mode d59bcbc Handle mouse leaving initial window in `mouse-set-region' (Bu... 27fe1e4 org.el: Fix bindings of < and > for calendar scrolling a813487 Fix undo boundary in recursive edit (Bug#23632) 1f85b7c Doc fixes re alist-get. (Bug#23548) ba3f206 * lisp/progmodes/python.el (inferior-python-mode): Avoid tabs... 56fa055 * src/syntax.c (syms_of_syntax) <comment-end-can-be-escaped>:... 4c1370a * lisp/help-fns.el (describe-function-1): Fix handling of fil... a3f7ae8 * lisp/emacs-lisp/cl-macs.el (cl-loop): Doc fix re "by". 601b9b2 * doc/misc/cl.texi (Mapping over Sequences): Fix cl-notevery.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el40
1 files changed, 38 insertions, 2 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index d4089a3ea92..ad69f8779e0 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2700,6 +2700,7 @@ variable.
\(Type \\[describe-mode] in the process buffer for a list of commands.)"
(when python-shell--parent-buffer
(python-util-clone-local-variables python-shell--parent-buffer))
+ (set (make-local-variable 'indent-tabs-mode) nil)
;; Users can interactively override default values for
;; `python-shell-interpreter' and `python-shell-interpreter-args'
;; when calling `run-python'. This ensures values let-bound in
@@ -4313,12 +4314,47 @@ returns will be used. If not FORCE-PROCESS is passed what
(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
+ :version "25.1")
+
+(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
+ :version "25.1")
+
(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 this 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'.