emacs-devel
[Top][All Lists]
Advanced

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

Re: Small improvements to ruby-mode


From: Dmitry Gutov
Subject: Re: Small improvements to ruby-mode
Date: Sat, 22 Jun 2013 03:31:22 +0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt)

>> * Font-lock changes
>> Some of the Ruby "keywords" that are currently highlighted as keywords are
>> not actually Ruby keywords, but plain methods - alias_method,
>> module_function, throw, raise, private, protected, public. I feel that they
>> should not be highlighted like this to keep the highlighting syntactically
>> correct. Technically speaking true, false and self are also keywords, but
>> given their semantics I guess the current highlighting is ok. 
>> On a related note I think that it would make sense to use
>> font-lock-builtin-face for methods like  alias_method, module_function,
>> throw, raise, private, protected, public and other keyword like methods for
>> Kernel and Module. I feel that such a move would increase the readability of
>> the Ruby source code.

Good idea, done in revno 113128. I also added require, require_relative
and autoload to the second list. Should we add more, e.g. include,
attr_accessor, using, refine?

>> * Treat more filenames/file extensions as Ruby code
>
>> Most 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 be
> made 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 if
> consolidated into a single regexp).  Why are so many different namings
> used?

These are for different tools, using different DSLs inside. Anyway, I
blame Make, they started it.

> It sounds like the Ruby people consider that all the world is
> Ruby and other tools just have to deal with it.  Would it have been so
> hard to add a .rb to all those <Foo>file ?

Most of (?) these work just as well if you add the extension, but nobody
actually does that.

>> * Implement some ruby-tools like commands in ruby-mode
>> ruby-tools is a small package, that adds some extra code manipulation
>> commands https://github.com/rejeep/ruby-tools
>
> We could integrate it into ruby-mode, of course.

I'm not so sure about re-implementing it, though. It's easy enough to
install in its current form, no?

Patches and suggestions on what polish we could provide exactly are
always welcome.



reply via email to

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