emacs-devel
[Top][All Lists]
Advanced

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

Re: Cutoff date for adding ruby-ts-mode?


From: Juri Linkov
Subject: Re: Cutoff date for adding ruby-ts-mode?
Date: Mon, 02 Jan 2023 20:44:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>> 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.



reply via email to

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