diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index de251181c14..3399429538f 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -3958,6 +3958,17 @@ Interactively, prompt for symbol." | |||
| 3958 | (message (python-eldoc--get-doc-at-point symbol))) | 3958 | (message (python-eldoc--get-doc-at-point symbol))) |
| 3959 | 3959 | ||
| 3960 | 3960 | ||
| 3961 | ;;; Hideshow | ||
| 3962 | |||
| 3963 | (defun python-hideshow-forward-sexp-function (arg) | ||
| 3964 | "Python specific `forward-sexp' function for `hs-minor-mode'. | ||
| 3965 | Argument ARG is ignored." | ||
| 3966 | arg ; Shut up, byte compiler. | ||
| 3967 | (python-nav-end-of-defun) | ||
| 3968 | (unless (python-info-current-line-empty-p) | ||
| 3969 | (backward-char))) | ||
| 3970 | |||
| 3971 | |||
| 3961 | ;;; Imenu | 3972 | ;;; Imenu |
| 3962 | 3973 | ||
| 3963 | (defvar python-imenu-format-item-label-function | 3974 | (defvar python-imenu-format-item-label-function |
| @@ -4693,11 +4704,16 @@ Arguments START and END narrow the buffer region to work on." | |||
| 4693 | (add-function :before-until (local 'eldoc-documentation-function) | 4704 | (add-function :before-until (local 'eldoc-documentation-function) |
| 4694 | #'python-eldoc-function)) | 4705 | #'python-eldoc-function)) |
| 4695 | 4706 | ||
| 4696 | (add-to-list 'hs-special-modes-alist | 4707 | (add-to-list |
| 4697 | `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#" | 4708 | 'hs-special-modes-alist |
| 4698 | ,(lambda (_arg) | 4709 | `(python-mode |
| 4699 | (python-nav-end-of-defun)) | 4710 | "\\s-*\\(?:def\\|class\\)\\>" |
| 4700 | nil)) | 4711 | ;; Use the empty string as end regexp so it doesn't default to |
| 4712 | ;; "\\s)". This way parens at end of defun are properly hidden. | ||
| 4713 | "" | ||
| 4714 | "#" | ||
| 4715 | python-hideshow-forward-sexp-function | ||
| 4716 | nil)) | ||
| 4701 | 4717 | ||
| 4702 | (set (make-local-variable 'outline-regexp) | 4718 | (set (make-local-variable 'outline-regexp) |
| 4703 | (python-rx (* space) block-start)) | 4719 | (python-rx (* space) block-start)) |