|
From: | Bozhidar Batsov |
Subject: | Re: Small improvements to ruby-mode |
Date: | Sat, 22 Jun 2013 10:05:27 +0300 |
* Font-lock changesSome of the Ruby "keywords" that are currently highlighted as keywords arenot actually Ruby keywords, but plain methods - alias_method,module_function, throw, raise, private, protected, public. I feel that theyshould not be highlighted like this to keep the highlighting syntacticallycorrect. Technically speaking true, false and self are also keywords, butgiven their semantics I guess the current highlighting is ok.On a related note I think that it would make sense to usefont-lock-builtin-face for methods like alias_method, module_function,throw, raise, private, protected, public and other keyword like methods forKernel and Module. I feel that such a move would increase the readability ofthe Ruby source code.Good idea, done in revno 113128. I also added require, require_relativeand autoload to the second list.
Should we add more, e.g. include,attr_accessor, using, refine?
* Treat more filenames/file extensions as Ruby codeMost Rubyists these days have to add the following in their Emacs config:(add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))(add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode))(add-to-list 'auto-mode-alist '("Gemfile\\'" . ruby-mode))(add-to-list 'auto-mode-alist '("Guardfile\\'" . ruby-mode))(add-to-list 'auto-mode-alist '("Capfile\\'" . ruby-mode))(add-to-list 'auto-mode-alist '("\\.thor\\'" . ruby-mode))(add-to-list 'auto-mode-alist '("Thorfile\\'" . ruby-mode))(add-to-list 'auto-mode-alist '("Vagrantfile\\'" . ruby-mode))(add-to-list 'auto-mode-alist '("\\.jbuilder\\'" . ruby-mode))These should be consolidated into a single regexp and should probably bemade a bit tighter (e.g. don't put BadCapfile in ruby-mode).Also done, revno 113129 and 113130.
I'm not too happy about having so many different patterns, tho (even ifconsolidated into a single regexp). Why are so many different namingsused?These are for different tools, using different DSLs inside. Anyway, Iblame Make, they started it.It sounds like the Ruby people consider that all the world isRuby and other tools just have to deal with it. Would it have been sohard to add a .rb to all those <Foo>file ?Most of (?) these work just as well if you add the extension, but nobodyactually does that.* Implement some ruby-tools like commands in ruby-moderuby-tools is a small package, that adds some extra code manipulationcommands https://github.com/rejeep/ruby-toolsWe could integrate it into ruby-mode, of course.I'm not so sure about re-implementing it, though. It's easy enough toinstall in its current form, no?
Patches and suggestions on what polish we could provide exactly arealways welcome.
[Prev in Thread] | Current Thread | [Next in Thread] |