[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master fd97cc8e0d: Fix completion-predicate of Python shell commands
From: |
Stefan Kangas |
Subject: |
master fd97cc8e0d: Fix completion-predicate of Python shell commands |
Date: |
Mon, 22 Aug 2022 23:06:54 -0400 (EDT) |
branch: master
commit fd97cc8e0df0c0f6dd83726abd11570c08bfc897
Author: Augusto Stoffel <arstoffel@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>
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)
---
lisp/progmodes/python.el | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index a545240805..e1347754c4 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -5897,6 +5897,7 @@ REPORT-FN is Flymake's callback function."
(add-hook 'flymake-diagnostic-functions #'python-flymake nil t))
;;; Completion predicates for M-x
+;; Commands that only make sense when editing Python code
(dolist (sym '(python-check
python-fill-paragraph
python-indent-dedent-line
@@ -5928,6 +5929,13 @@ REPORT-FN is Flymake's callback function."
python-shell-send-statement))
(put sym 'completion-predicate #'python--completion-predicate))
+(defun python-shell--completion-predicate (_ buffer)
+ (provided-mode-derived-p
+ (buffer-local-value 'major-mode buffer)
+ 'python-mode 'inferior-python-mode))
+
+;; Commands that only make sense in the Python shell or when editing
+;; Python code.
(dolist (sym '(python-describe-at-point
python-eldoc-at-point
python-shell-completion-native-toggle
@@ -5940,7 +5948,7 @@ REPORT-FN is Flymake's callback function."
python-shell-font-lock-turn-on
python-shell-package-enable
python-shell-completion-complete-or-indent ))
- (put sym 'completion-predicate #'python--completion-predicate))
+ (put sym 'completion-predicate #'python-shell--completion-predicate))
(provide 'python)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master fd97cc8e0d: Fix completion-predicate of Python shell commands,
Stefan Kangas <=