From 5763035187f3128030ac4b098b97ddac01c9f9ee Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Fri, 13 Apr 2012 00:36:53 +0100 Subject: [PATCH] Enable hs-mode (HideShow) within ruby-mode --- mode-customizations/ruby-mode.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mode-customizations/ruby-mode.el b/mode-customizations/ruby-mode.el index e0f88bb..8cbbdfa 100644 --- a/mode-customizations/ruby-mode.el +++ b/mode-customizations/ruby-mode.el @@ -30,9 +30,12 @@ (setq c-tab-always-indent nil) (setq ruby-use-encoding-map nil) (setq ruby-electric-expand-delimiters-list (quote (124))) + (hs-minor-mode 1) (setq whitespace-action (quote (auto-cleanup))) (define-key ruby-mode-map (kbd "RET") 'reindent-then-newline-and-indent) + (define-key ruby-mode-map + (kbd "C-c C-j") 'hs-toggle-hiding) (define-key ruby-mode-map (kbd "s-r") 'ruby-compilation-this-buffer) (define-key ruby-mode-map @@ -46,6 +49,12 @@ (define-key ruby-mode-map (kbd "C-c C-b") 'eproject-ibuffer))) +;; Set up hs-mode (HideShow) for Ruby +(add-to-list 'hs-special-modes-alist + '(ruby-mode + "\\(def \\|class\\|module\\|do\\)" "end" "#" + (lambda (arg) (ruby-end-of-block)) nil)) + ;; Workaround for missing method in ruby-mode.el ;; See: https://gist.github.com/1213051 (defun ruby-insert-end ()