aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-07-31 18:44:02 +0200
committerLars Ingebrigtsen2021-07-31 18:44:02 +0200
commit2dcb0f8f5241d0fcdcdb3da10d3eb4d7916e4869 (patch)
tree1f35d20bb865eca582255ca6c2464e21e9ad3ded /lisp/progmodes/python.el
parentf6c5a801efdad6cc7ed16ac0b1fa53599b84bc91 (diff)
downloademacs-2dcb0f8f5241d0fcdcdb3da10d3eb4d7916e4869.tar.gz
emacs-2dcb0f8f5241d0fcdcdb3da10d3eb4d7916e4869.zip
Add new user option python-forward-sexp-function
* lisp/progmodes/python.el (python-forward-sexp-function): New user option (bug#41361). (python-mode): Use it.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el18
1 files changed, 9 insertions, 9 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index f7267bdef29..2557704e403 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -54,14 +54,7 @@
54;; `python-nav-backward-statement', 54;; `python-nav-backward-statement',
55;; `python-nav-beginning-of-statement', `python-nav-end-of-statement', 55;; `python-nav-beginning-of-statement', `python-nav-end-of-statement',
56;; `python-nav-beginning-of-block', `python-nav-end-of-block' and 56;; `python-nav-beginning-of-block', `python-nav-end-of-block' and
57;; `python-nav-if-name-main' are included but no bound to any key. At 57;; `python-nav-if-name-main' are included but no bound to any key.
58;; last but not least the specialized `python-nav-forward-sexp' allows
59;; easy navigation between code blocks. If you prefer `cc-mode'-like
60;; `forward-sexp' movement, setting `forward-sexp-function' to nil is
61;; enough, You can do that using the `python-mode-hook':
62
63;; (add-hook 'python-mode-hook
64;; (lambda () (setq forward-sexp-function nil)))
65 58
66;; Shell interaction: is provided and allows opening Python shells 59;; Shell interaction: is provided and allows opening Python shells
67;; inside Emacs and executing any block of code of your current buffer 60;; inside Emacs and executing any block of code of your current buffer
@@ -5505,6 +5498,13 @@ By default messages are considered errors."
5505 :type '(alist :key-type (regexp) 5498 :type '(alist :key-type (regexp)
5506 :value-type (symbol))) 5499 :value-type (symbol)))
5507 5500
5501(defcustom python-forward-sexp-function #'python-nav-forward-sexp
5502 "Function to use when navigating between expressions."
5503 :version "28.1"
5504 :type '(choice (const :tag "Python blocks" python-nav-forward-sexp)
5505 (const :tag "CC-mode like" nil)
5506 function))
5507
5508(defvar-local python--flymake-proc nil) 5508(defvar-local python--flymake-proc nil)
5509 5509
5510(defun python--flymake-parse-output (source proc report-fn) 5510(defun python--flymake-parse-output (source proc report-fn)
@@ -5602,7 +5602,7 @@ REPORT-FN is Flymake's callback function."
5602 (setq-local parse-sexp-lookup-properties t) 5602 (setq-local parse-sexp-lookup-properties t)
5603 (setq-local parse-sexp-ignore-comments t) 5603 (setq-local parse-sexp-ignore-comments t)
5604 5604
5605 (setq-local forward-sexp-function #'python-nav-forward-sexp) 5605 (setq-local forward-sexp-function python-forward-sexp-function)
5606 5606
5607 (setq-local font-lock-defaults 5607 (setq-local font-lock-defaults
5608 `(,python-font-lock-keywords 5608 `(,python-font-lock-keywords