[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] add outline regexp to ruby-mode

From: Yilkal Argaw
Subject: [PATCH] add outline regexp to ruby-mode
Date: Wed, 6 Jul 2022 02:28:53 +0300

Hello guys.
Some programming modes built into emacs provide outline-regexp to
allow for code folding and an example of this is python-mode.
"ruby-mode" on the other hand does does not have this feature. Since
it is a very handy feature to have it might be worth adding with the
following simple patch.

diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index a197724634..6437b84628 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -2447,6 +2447,7 @@ ruby--prettify-symbols-alist
     ("lambda" . ?λ))
   "Value for `prettify-symbols-alist' in `ruby-mode'.")

 (define-derived-mode ruby-mode prog-mode "Ruby"
   "Major mode for editing Ruby code."
@@ -2465,7 +2466,8 @@ ruby-mode
                                    ((?_ . "w"))))
   (setq-local prettify-symbols-alist ruby--prettify-symbols-alist)

-  (setq-local syntax-propertize-function #'ruby-syntax-propertize))
+  (setq-local syntax-propertize-function #'ruby-syntax-propertize)
+  (setq-local outline-regexp ruby-indent-beg-re))

 ;;; Invoke ruby-mode when appropriate

reply via email to

[Prev in Thread] Current Thread [Next in Thread]