aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorAugusto Stoffel2022-08-22 18:16:50 +0200
committerStefan Kangas2022-08-23 05:06:32 +0200
commitfd97cc8e0df0c0f6dd83726abd11570c08bfc897 (patch)
treeb5298aaafee9e17c5a45a8d78e710bb768f256cb /lisp/progmodes/python.el
parentb7e867b841f47dcff3aeaef9b5608a237386ce70 (diff)
downloademacs-fd97cc8e0df0c0f6dd83726abd11570c08bfc897.tar.gz
emacs-fd97cc8e0df0c0f6dd83726abd11570c08bfc897.zip
Fix completion-predicate of Python shell commands
* lisp/progmodes/python.el: Change some completion predicates. (python-shell--completion-predicate): New completion predicate function. (Bug#57184)
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index a545240805a..e1347754c4a 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -5897,6 +5897,7 @@ REPORT-FN is Flymake's callback function."
5897 (add-hook 'flymake-diagnostic-functions #'python-flymake nil t)) 5897 (add-hook 'flymake-diagnostic-functions #'python-flymake nil t))
5898 5898
5899;;; Completion predicates for M-x 5899;;; Completion predicates for M-x
5900;; Commands that only make sense when editing Python code
5900(dolist (sym '(python-check 5901(dolist (sym '(python-check
5901 python-fill-paragraph 5902 python-fill-paragraph
5902 python-indent-dedent-line 5903 python-indent-dedent-line
@@ -5928,6 +5929,13 @@ REPORT-FN is Flymake's callback function."
5928 python-shell-send-statement)) 5929 python-shell-send-statement))
5929 (put sym 'completion-predicate #'python--completion-predicate)) 5930 (put sym 'completion-predicate #'python--completion-predicate))
5930 5931
5932(defun python-shell--completion-predicate (_ buffer)
5933 (provided-mode-derived-p
5934 (buffer-local-value 'major-mode buffer)
5935 'python-mode 'inferior-python-mode))
5936
5937;; Commands that only make sense in the Python shell or when editing
5938;; Python code.
5931(dolist (sym '(python-describe-at-point 5939(dolist (sym '(python-describe-at-point
5932 python-eldoc-at-point 5940 python-eldoc-at-point
5933 python-shell-completion-native-toggle 5941 python-shell-completion-native-toggle
@@ -5940,7 +5948,7 @@ REPORT-FN is Flymake's callback function."
5940 python-shell-font-lock-turn-on 5948 python-shell-font-lock-turn-on
5941 python-shell-package-enable 5949 python-shell-package-enable
5942 python-shell-completion-complete-or-indent )) 5950 python-shell-completion-complete-or-indent ))
5943 (put sym 'completion-predicate #'python--completion-predicate)) 5951 (put sym 'completion-predicate #'python-shell--completion-predicate))
5944 5952
5945(provide 'python) 5953(provide 'python)
5946 5954