aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
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.
2700\(Type \\[describe-mode] in the process buffer for a list of commands.)" 2700\(Type \\[describe-mode] in the process buffer for a list of commands.)"
2701 (when python-shell--parent-buffer 2701 (when python-shell--parent-buffer
2702 (python-util-clone-local-variables python-shell--parent-buffer)) 2702 (python-util-clone-local-variables python-shell--parent-buffer))
2703 (set (make-local-variable 'indent-tabs-mode) nil)
2703 ;; Users can interactively override default values for 2704 ;; Users can interactively override default values for
2704 ;; `python-shell-interpreter' and `python-shell-interpreter-args' 2705 ;; `python-shell-interpreter' and `python-shell-interpreter-args'
2705 ;; when calling `run-python'. This ensures values let-bound in 2706 ;; 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
4313 (unless (zerop (length docstring)) 4314 (unless (zerop (length docstring))
4314 docstring))))) 4315 docstring)))))
4315 4316
4317(defvar-local python-eldoc-get-doc t
4318 "Non-nil means eldoc should fetch the documentation
4319 automatically. Set to nil by `python-eldoc-function' if
4320 `python-eldoc-function-timeout-permanent' is non-nil and
4321 `python-eldoc-function' times out.")
4322
4323(defcustom python-eldoc-function-timeout 1
4324 "Timeout for `python-eldoc-function' in seconds."
4325 :group 'python
4326 :type 'integer
4327 :version "25.1")
4328
4329(defcustom python-eldoc-function-timeout-permanent t
4330 "Non-nil means that when `python-eldoc-function' times out
4331`python-eldoc-get-doc' will be set to nil"
4332 :group 'python
4333 :type 'boolean
4334 :version "25.1")
4335
4316(defun python-eldoc-function () 4336(defun python-eldoc-function ()
4317 "`eldoc-documentation-function' for Python. 4337 "`eldoc-documentation-function' for Python.
4318For this to work as best as possible you should call 4338For this to work as best as possible you should call
4319`python-shell-send-buffer' from time to time so context in 4339`python-shell-send-buffer' from time to time so context in
4320inferior Python process is updated properly." 4340inferior Python process is updated properly.
4321 (python-eldoc--get-doc-at-point)) 4341
4342If `python-eldoc-function-timeout' seconds elapse before this
4343function returns then if
4344`python-eldoc-function-timeout-permanent' is non-nil
4345`python-eldoc-get-doc' will be set to nil and eldoc will no
4346longer return the documentation at the point automatically.
4347
4348Set `python-eldoc-get-doc' to t to reenable eldoc documentation
4349fetching"
4350 (when python-eldoc-get-doc
4351 (with-timeout (python-eldoc-function-timeout
4352 (if python-eldoc-function-timeout-permanent
4353 (progn
4354 (message "Eldoc echo-area display muted in this buffer, see `python-eldoc-function'")
4355 (setq python-eldoc-get-doc nil))
4356 (message "`python-eldoc-function' timed out, see `python-eldoc-function-timeout'")))
4357 (python-eldoc--get-doc-at-point))))
4322 4358
4323(defun python-eldoc-at-point (symbol) 4359(defun python-eldoc-at-point (symbol)
4324 "Get help on SYMBOL using `help'. 4360 "Get help on SYMBOL using `help'.