<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,7 @@
+2007-08-15  Dmitry Galinsky  &lt;dima.exe@gmail.com&gt;
+
+	* rails-ruby.el (ruby-hs-minor-mode): created, support ruby in hs-minor-mode
+
 2007-08-11  Dmitry Galinsky  &lt;dima.exe@gmail.com&gt;
 
 	* rails-compat.el (try-complete-abbrev): fixed</diff>
      <filename>ChangeLog</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,5 @@
 SVN
+* Added ruby-mode support in hs-minor-mode (aka folding).
 * Added migrations and configuration files to speedbar.
 * More shortcuts for tests.
 </diff>
      <filename>History</filename>
    </modified>
    <modified>
      <diff>@@ -28,7 +28,8 @@
 
 (defvar rails-features:list
   '(rails-snippets-feature
-    rails-speedbar-feature)
+    rails-speedbar-feature
+    rails-rspec-feature)
   &quot;List of features&quot;)
 
 (defvar rails-features:installed-p nil)</diff>
      <filename>rails-features.el</filename>
    </modified>
    <modified>
      <diff>@@ -26,8 +26,6 @@
 
 ;;; Code:
 
-(require 'inf-ruby)
-
 ;; setup align for ruby-mode
 (require 'align)
 
@@ -56,6 +54,77 @@ See the variable `align-rules-list' for more details.&quot;)
 (dolist (it ruby-align-rules-list)
   (add-to-list 'align-rules-list it))
 
+;; hideshow ruby support
+
+(defun display-code-line-counts (ov)
+  (when (eq 'code (overlay-get ov 'hs))
+    (overlay-put ov 'face 'font-lock-comment-face)
+    (overlay-put ov 'display
+                 (format &quot; &#187;&#187;&#187; %d lines&quot;
+                         (count-lines (overlay-start ov)
+                                      (overlay-end ov))))))
+
+(defun ruby-hs-minor-mode (&amp;optional arg)
+  (interactive)
+  (require 'hideshow)
+  (unless (assoc 'ruby-mode hs-special-modes-alist)
+    (setq
+     hs-special-modes-alist
+     (cons (list 'ruby-mode
+                 &quot;\\(def\\|do\\)&quot;
+                 &quot;end&quot;
+                 &quot;#&quot;
+                 (lambda (&amp;rest args) (ruby-end-of-block))
+                 ;(lambda (&amp;rest args) (ruby-beginning-of-defun))
+                 )
+           hs-special-modes-alist)))
+  (unless hs-set-up-overlay
+    (setq hs-set-up-overlay 'display-code-line-counts))
+  (hs-minor-mode arg))
+
+;; flymake ruby support
+
+(require 'flymake nil t)
+
+(defconst flymake-allowed-ruby-file-name-masks
+  '((&quot;\\.rb\\'&quot;      flymake-ruby-init)
+    (&quot;\\.rxml\\'&quot;    flymake-ruby-init)
+    (&quot;\\.builder\\'&quot; flymake-ruby-init)
+    (&quot;\\.rjs\\'&quot;     flymake-ruby-init))
+  &quot;Filename extensions that switch on flymake-ruby mode syntax checks.&quot;)
+
+(defconst flymake-ruby-error-line-pattern-regexp
+  '(&quot;^\\([^:]+\\):\\([0-9]+\\): *\\([\n]+\\)&quot; 1 2 nil 3)
+  &quot;Regexp matching ruby error messages.&quot;)
+
+(defun flymake-ruby-init ()
+  (condition-case er
+      (let* ((temp-file (flymake-init-create-temp-buffer-copy
+                         'flymake-create-temp-inplace))
+             (local-file  (file-relative-name
+                           temp-file
+                           (file-name-directory buffer-file-name))))
+        (list rails-ruby-command (list &quot;-c&quot; local-file)))
+    ('error ())))
+
+(defun flymake-ruby-load ()
+  (when (and (buffer-file-name)
+             (string-match
+              (format &quot;\\(%s\\)&quot;
+                      (string-join
+                       &quot;\\|&quot;
+                       (mapcar 'car flymake-allowed-ruby-file-name-masks)))
+              (buffer-file-name)))
+    (setq flymake-allowed-file-name-masks
+          (append flymake-allowed-file-name-masks flymake-allowed-ruby-file-name-masks))
+    (setq flymake-err-line-patterns
+          (cons flymake-ruby-error-line-pattern-regexp flymake-err-line-patterns))
+    (flymake-mode t)
+    (local-set-key (rails-key &quot;d&quot;) 'flymake-display-err-menu-for-current-line)))
+
+(when (featurep 'flymake)
+  (add-hook 'ruby-mode-hook 'flymake-ruby-load))
+
 ;; other stuff
 
 (defun ruby-newline-and-indent ()
@@ -95,6 +164,8 @@ See the variable `align-rules-list' for more details.&quot;)
           (insert (format &quot;'%s'&quot; symbol-str))))))
     (goto-char initial-pos)))
 
+(require 'inf-ruby)
+
 (defun run-ruby-in-buffer (cmd buf)
   &quot;Run CMD as a ruby process in BUF if BUF does not exist.&quot;
   (let ((abuf (concat &quot;*&quot; buf &quot;*&quot;)))
@@ -121,47 +192,5 @@ See the variable `align-rules-list' for more details.&quot;)
                (cmd (if maxnum (concat cmd (format &quot;[0...%s]&quot; maxnum)) cmd)))
           (el4r-ruby-eval (format cmd (word-at-point) prefix prefix)))))))
 
-;; flymake ruby support
-
-(require 'flymake nil t)
-
-(defconst flymake-allowed-ruby-file-name-masks
-  '((&quot;\\.rb\\'&quot;      flymake-ruby-init)
-    (&quot;\\.rxml\\'&quot;    flymake-ruby-init)
-    (&quot;\\.builder\\'&quot; flymake-ruby-init)
-    (&quot;\\.rjs\\'&quot;     flymake-ruby-init))
-  &quot;Filename extensions that switch on flymake-ruby mode syntax checks.&quot;)
-
-(defconst flymake-ruby-error-line-pattern-regexp
-  '(&quot;^\\([^:]+\\):\\([0-9]+\\): *\\([\n]+\\)&quot; 1 2 nil 3)
-  &quot;Regexp matching ruby error messages.&quot;)
-
-(defun flymake-ruby-init ()
-  (condition-case er
-      (let* ((temp-file (flymake-init-create-temp-buffer-copy
-                         'flymake-create-temp-inplace))
-             (local-file  (file-relative-name
-                           temp-file
-                           (file-name-directory buffer-file-name))))
-        (list rails-ruby-command (list &quot;-c&quot; local-file)))
-    ('error ())))
-
-(defun flymake-ruby-load ()
-  (when (and (buffer-file-name)
-             (string-match
-              (format &quot;\\(%s\\)&quot;
-                      (string-join
-                       &quot;\\|&quot;
-                       (mapcar 'car flymake-allowed-ruby-file-name-masks)))
-              (buffer-file-name)))
-    (setq flymake-allowed-file-name-masks
-          (append flymake-allowed-file-name-masks flymake-allowed-ruby-file-name-masks))
-    (setq flymake-err-line-patterns
-          (cons flymake-ruby-error-line-pattern-regexp flymake-err-line-patterns))
-    (flymake-mode t)
-    (local-set-key (rails-key &quot;d&quot;) 'flymake-display-err-menu-for-current-line)))
-
-(when (featurep 'flymake)
-  (add-hook 'ruby-mode-hook 'flymake-ruby-load))
 
 (provide 'rails-ruby)
\ No newline at end of file</diff>
      <filename>rails-ruby.el</filename>
    </modified>
    <modified>
      <diff>@@ -395,6 +395,7 @@ necessary.&quot;
             (require 'rails-ruby)
             (require 'ruby-electric)
             (ruby-electric-mode t)
+            (ruby-hs-minor-mode t)
             (imenu-add-to-menubar &quot;IMENU&quot;)
             (modify-syntax-entry ?! &quot;w&quot; (syntax-table))
             (modify-syntax-entry ?: &quot;w&quot; (syntax-table))</diff>
      <filename>rails.el</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>154f696c1dc0685f86a757dbde32e30902034145</id>
    </parent>
  </parents>
  <author>
    <name>dimaexe</name>
    <email>dimaexe@cc5033d0-740f-0410-afc7-949910e492f2</email>
  </author>
  <url>http://github.com/tomtt/emacs-rails/commit/62757ee444863699e97071602b5e07e41006b4c8</url>
  <id>62757ee444863699e97071602b5e07e41006b4c8</id>
  <committed-date>2007-08-15T11:41:32-07:00</committed-date>
  <authored-date>2007-08-15T11:41:32-07:00</authored-date>
  <message>rails-ruby.el (ruby-hs-minor-mode): created, support ruby in hs-minor-mode


git-svn-id: svn+ssh://rubyforge.org/var/svn/emacs-rails/trunk@207 cc5033d0-740f-0410-afc7-949910e492f2</message>
  <tree>13425a460dcc52a31de0080ae132017d29875595</tree>
  <committer>
    <name>dimaexe</name>
    <email>dimaexe@cc5033d0-740f-0410-afc7-949910e492f2</email>
  </committer>
</commit>
