I found myself needing code folding in PHP5 again, and switched to TextMate for a few days. But it just doesn't handle things right ... nice UI, but it inserts a <% %> every time I press ^x which drove me nuts. So I worked out how to make code folding for PHP5 work in Aquamacs, and here it is (for your .emacs).
(defun show-onelevel ()
"show entry and children in outline mode"
(interactive)
(show-entry)
(show-children))
;;
(defun cjm-outline-bindings ()
"sets shortcut bindings for outline minor mode"
(interactive)
(local-set-key [?\C-,] 'hide-sublevels)
(local-set-key [?\C-.] 'show-all)
(local-set-key [C-up] 'outline-previous-visible-heading)
(local-set-key [C-down] 'outline-next-visible-heading)
(local-set-key [C-left] 'hide-subtree)
(local-set-key [C-right] 'show-onelevel)
(local-set-key [M-up] 'outline-backward-same-level)
(local-set-key [M-down] 'outline-forward-same-level)
(local-set-key [M-left] 'hide-subtree)
(local-set-key [M-right] 'show-subtree))
;;
(add-hook 'outline-minor-mode-hook
'cjm-outline-bindings)
;;
(add-hook 'php-mode-user-hook
'(lambda ()
(outline-minor-mode)
(setq outline-regexp " *\\(public funct\\|private funct\\|funct\\|class\\|#head\\)")
(hide-sublevels 1)))
;;
(add-hook 'python-mode-hook
'(lambda ()
(outline-minor-mode)
(setq outline-regexp " *\\(def \\|clas\\|#hea\\)")
(hide-sublevels 1)))
Did I mention it's just crude enough to work for me?
Comments
Thanks
Thanks, I been looking for something like this and it works great!
Post new comment