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: Dmitry Gutov
Subject: Re: Cutoff date for adding ruby-ts-mode?
Date: Tue, 3 Jan 2023 03:22:14 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

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 via email to

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