Last active
February 21, 2020 14:47
-
-
Save vv111y/db91372b34b99d317228a78082d49625 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; outline-minor-mode needs to be enabled for this to work. | |
(setq py-docstring-regexp "\"\"\"") | |
(defvar py-docstrings-folded nil) | |
(defun py-toggle-docstrings () | |
(interactive) | |
(if py-docstrings-folded | |
(setq py-docstrings-folded nil) | |
(setq py-docstrings-folded t)) | |
(save-excursion | |
(goto-char (point-min)) | |
(let ((start) (end)) | |
(while (and | |
(setq start (re-search-forward py-docstring-regexp nil t)) | |
(setq end (re-search-forward py-docstring-regexp nil t))) | |
(outline-flag-region start end py-docstrings-folded))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment