unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Juri Linkov <juri@linkov.net>, Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org, pedz@easesoftware.com
Subject: Re: Cutoff date for adding ruby-ts-mode?
Date: Tue, 3 Jan 2023 03:22:14 +0200	[thread overview]
Message-ID: <95e27f0a-958b-0a39-b459-3d995a6ad28d@yandex.ru> (raw)
In-Reply-To: <86edscwzcj.fsf@mail.linkov.net>

On 02/01/2023 20:44, Juri Linkov wrote:
>>> Sorry for the delay, ruby-ts-mode is now in emacs-29.
>>
>> Thanks.
>>
>>> Some rough edges around indentation remain (to be addressed in the
>>> coming weeks), but the mode should be useful enough now.
>>
>> Good plan.
> 
> I confirm that everything in ruby-ts-mode works great.
> Thanks Perry and Dmitry.  One question is how to share
> configuration between ruby-mode and ruby-ts-mode.
> 
> I guess since only one of modes makes sense within the
> same session then the same hook could be run only
> for one of these modes, selecting one on them
> with `treesit-available-p' (note that `treesit-ready-p'
> can't be used until treesit is loaded):
> 
>    (add-hook (if (treesit-available-p) 'ruby-ts-mode-hook 'ruby-mode-hook)
>              (lambda ()
> 
>                (when (treesit-available-p)
>                  ;; Copied from `ruby-mode' for `ruby-ts-mode':
>                  (setq-local outline-regexp (concat "^\\s *"
>                                     (regexp-opt '("class" "module" "def"))
>                                     "\\_>"))
>                  (setq-local outline-level (lambda () (1+ (/ (current-indentation)
>                                                ruby-indent-level))))
>                  (add-hook 'flymake-diagnostic-functions #'ruby-flymake-auto nil 'local))
> 
>                ;; Other common settings
>                ;; ...
>    ))
> 
> Also the problem is that the default settings seen above
> are not shared between modes.

Good question, thanks. I've pushed a change in 6dd3e352f44 that moves 
the common code to a common base mode to derive from.

Those include the settings you quote above, as well as the setup for 
electric-indent-functions and prettify-symbols-alist.

And to answer the question itself, I guess you can use 
ruby-base-mode-hook now.



      reply	other threads:[~2023-01-03  1:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-29 21:39 Cutoff date for adding ruby-ts-mode? Dmitry Gutov
2022-12-30  8:16 ` Eli Zaretskii
2022-12-30 15:32   ` Dmitry Gutov
2022-12-30 16:59     ` Eli Zaretskii
2022-12-30 21:42       ` Dmitry Gutov
2022-12-31  6:31         ` Eli Zaretskii
2022-12-31 11:24         ` Stefan Kangas
2023-01-02  1:35   ` Dmitry Gutov
2023-01-02 12:51     ` Eli Zaretskii
2023-01-02 18:44       ` Juri Linkov
2023-01-03  1:22         ` Dmitry Gutov [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=95e27f0a-958b-0a39-b459-3d995a6ad28d@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=juri@linkov.net \
    --cc=pedz@easesoftware.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).