mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
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.
This commit is contained in:
parent
f6c5a801ef
commit
2dcb0f8f52
2 changed files with 14 additions and 9 deletions
5
etc/NEWS
5
etc/NEWS
|
|
@ -593,6 +593,11 @@ This is used to fontify non-scalar variables.
|
|||
|
||||
** Python mode
|
||||
|
||||
---
|
||||
*** New user option 'python-forward-sexp-function'.
|
||||
This allows the user to easier customize whether to use block-based
|
||||
navigation or not.
|
||||
|
||||
*** 'python-shell-interpreter' now defaults to python3 on systems with python3.
|
||||
|
||||
*** 'C-c C-r' can now be used on arbitrary regions.
|
||||
|
|
|
|||
|
|
@ -54,14 +54,7 @@
|
|||
;; `python-nav-backward-statement',
|
||||
;; `python-nav-beginning-of-statement', `python-nav-end-of-statement',
|
||||
;; `python-nav-beginning-of-block', `python-nav-end-of-block' and
|
||||
;; `python-nav-if-name-main' are included but no bound to any key. At
|
||||
;; last but not least the specialized `python-nav-forward-sexp' allows
|
||||
;; easy navigation between code blocks. If you prefer `cc-mode'-like
|
||||
;; `forward-sexp' movement, setting `forward-sexp-function' to nil is
|
||||
;; enough, You can do that using the `python-mode-hook':
|
||||
|
||||
;; (add-hook 'python-mode-hook
|
||||
;; (lambda () (setq forward-sexp-function nil)))
|
||||
;; `python-nav-if-name-main' are included but no bound to any key.
|
||||
|
||||
;; Shell interaction: is provided and allows opening Python shells
|
||||
;; inside Emacs and executing any block of code of your current buffer
|
||||
|
|
@ -5505,6 +5498,13 @@ By default messages are considered errors."
|
|||
:type '(alist :key-type (regexp)
|
||||
:value-type (symbol)))
|
||||
|
||||
(defcustom python-forward-sexp-function #'python-nav-forward-sexp
|
||||
"Function to use when navigating between expressions."
|
||||
:version "28.1"
|
||||
:type '(choice (const :tag "Python blocks" python-nav-forward-sexp)
|
||||
(const :tag "CC-mode like" nil)
|
||||
function))
|
||||
|
||||
(defvar-local python--flymake-proc nil)
|
||||
|
||||
(defun python--flymake-parse-output (source proc report-fn)
|
||||
|
|
@ -5602,7 +5602,7 @@ REPORT-FN is Flymake's callback function."
|
|||
(setq-local parse-sexp-lookup-properties t)
|
||||
(setq-local parse-sexp-ignore-comments t)
|
||||
|
||||
(setq-local forward-sexp-function #'python-nav-forward-sexp)
|
||||
(setq-local forward-sexp-function python-forward-sexp-function)
|
||||
|
||||
(setq-local font-lock-defaults
|
||||
`(,python-font-lock-keywords
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue