all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yilkal Argaw <yilkalargawworkneh@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: [PATCH] add outline regexp to ruby-mode
Date: Wed, 6 Jul 2022 02:48:55 +0300	[thread overview]
Message-ID: <CAJddU=p6eqsD-7ttdJUM03ExcfFWsAwjXSyNDKGuhw6rv8axKw@mail.gmail.com> (raw)
In-Reply-To: <CAJddU=qHhYNBiKU+ik0K4Y=RAR93_MUN_aQy9w+5r8QTWu3WgQ@mail.gmail.com>

> 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'.")
>
> +
>  ;;;###autoload
>  (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
> Sorry I just noticed the extra line break after I pressed send. Here is the
> patch without that line break.

diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index a197724634..7a62d72e06 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -2465,7 +2465,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



On Wed, Jul 6, 2022 at 2:28 AM Yilkal Argaw
<yilkalargawworkneh@gmail.com> wrote:
>
> 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'.")
>
> +
>  ;;;###autoload
>  (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	other threads:[~2022-07-05 23:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-05 23:28 [PATCH] add outline regexp to ruby-mode Yilkal Argaw
2022-07-05 23:48 ` Yilkal Argaw [this message]
2022-07-06  7:04   ` Bozhidar Batsov
2022-07-06  8:06     ` Juri Linkov
2022-07-08  1:12       ` Dmitry Gutov
2022-07-08  5:38         ` Bozhidar Batsov
2022-07-08  8:27           ` Yilkal Argaw
2022-07-08 17:18             ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJddU=p6eqsD-7ttdJUM03ExcfFWsAwjXSyNDKGuhw6rv8axKw@mail.gmail.com' \
    --to=yilkalargawworkneh@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.