Hi Karl,

Karl Voit <devn...@karl-voit.at> writes:

> This should fold all defs. Unfortunately, this does not work at my
> side. Did I make a mistake or do I have to limit myself to matching
> comment lines only?

simply turn on orgstruct-mode in a python buffer and try
M-x org-cycle RET on a def: it will fold it.

`orgstruct-heading-prefix-regexp' comes on top of that,
if needed, but as long as `outline-regexp' is properly
set, orgstruct-mode gives you the cycling commands.

For example, this is the bindings I have for emacs-lisp:

(global-set-key (kbd "C-M-]") (lambda () (interactive) (org-cycle t)))

(global-set-key (kbd "M-]")
                (lambda () (interactive)
                  (ignore-errors (end-of-defun) (beginning-of-defun)) 
(org-cycle)))

HTH,

-- 
 Bastien

Reply via email to