From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yilkal Argaw Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] add outline regexp to ruby-mode Date: Wed, 6 Jul 2022 02:48:55 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23746"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jul 06 04:23:33 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o8uhR-00063m-Aj for ged-emacs-devel@m.gmane-mx.org; Wed, 06 Jul 2022 04:23:33 +0200 Original-Received: from localhost ([::1]:39286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8uhP-0008GZ-NR for ged-emacs-devel@m.gmane-mx.org; Tue, 05 Jul 2022 22:23:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8sI1-000245-Fh for emacs-devel@gnu.org; Tue, 05 Jul 2022 19:49:09 -0400 Original-Received: from mail-yb1-xb31.google.com ([2607:f8b0:4864:20::b31]:34712) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8sHz-0002sC-St for emacs-devel@gnu.org; Tue, 05 Jul 2022 19:49:09 -0400 Original-Received: by mail-yb1-xb31.google.com with SMTP id i14so4895183yba.1 for ; Tue, 05 Jul 2022 16:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=HX2z1SuTHXTvgxuk81rNYE0JjFx2vj0/n4aEtN2mByE=; b=X7+wpjq321fCfV/JCj5VLoL3uT216v+K/LeYokXpZ//PJj4yXNlQjJMikBjcYNNnsE xR1r/djew9BrPNrFIxL6BsCcbT9vKosN5SQvus5gs7xLlbJC/4ppiqvn0UGZ1EWs0gKL XFRO9SWs7trZnpdhyWXpvW6m3W04+dQWMpm0yT0Io7t/dyLsZedD2+ZKOJ//oqG0H6F2 XQrK/zO9lk6bUAeYmg5J4qkHPZFPNI/7Xth253ZjyVGfBu509pcHJQvQH9nXz/pD3fwT jTvP7CBDNoHxrqRWUt2kGcnsakNuG55l6MsVhhocbBU+zM1Clrv4I+Z+R+hk0yA3tEoK D/pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=HX2z1SuTHXTvgxuk81rNYE0JjFx2vj0/n4aEtN2mByE=; b=eWdLEPypbEr2CQr5jks5Yb+DXg69MSzdkALbwMXbcoJgYnhdkPtxu4UVaE5EhBCgix 5ImqFJYqM+L+sujt5iUMI0p14BU9MHhsYVhtK/Vmw22OTfIXvzumo3psi22v6aix3Srx SZ96lV4jzRlRU13O4KJ4VRWp7qDfSSWVausncwYIkLd8Ut1wKStlBFs8vgVa+7s3EiyT +hNBGgR6ezkJckXVoPv4Xyyb+CrH74a6acaA32h2hRcMUx0YbrWxx4oHZTWrh3Ms1N/H tJQwY9Ae3M/a5sjUvHfglmNMXCcCcDRHhpewDT7hHOZthMc7gM4zg3sR+oNZjaXJeEcr DyXw== X-Gm-Message-State: AJIora8DJPgc4cSwi7rerpWodIwki6NzIrxENdDSBCu4Bcxwm2KQhyYg 2bmp0ZqIvn65U7MYFeJdB8DbsMFGgs5A1mlOD1QBaP8vmqs= X-Google-Smtp-Source: AGRyM1u376ZLklWuT6nEXlN+LpJfRbonZ/sED9A/36BlikfzvOr1qU78Ct1P1CNxKRAyRdTBeou/NBcgnqs/st3dXLo= X-Received: by 2002:a25:b391:0:b0:66d:7229:1fc9 with SMTP id m17-20020a25b391000000b0066d72291fc9mr40429959ybj.130.1657064946692; Tue, 05 Jul 2022 16:49:06 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::b31; envelope-from=yilkalargawworkneh@gmail.com; helo=mail-yb1-xb31.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 05 Jul 2022 22:22:10 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:291894 Archived-At: > 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" . ?=CE=BB)) > "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 t= he > 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 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" . ?=CE=BB)) > "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