unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Bozhidar Batsov <bozhidar@batsov.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: Small improvements to ruby-mode
Date: Sun, 23 Jun 2013 09:20:16 +0300	[thread overview]
Message-ID: <A5EEB3F6E32A4FFE86A35B9802F9960F@gmail.com> (raw)
In-Reply-To: <51C5A67A.2020002@yandex.ru>

[-- Attachment #1: Type: text/plain, Size: 3844 bytes --]



-- 
Cheers,
Bozhidar


On Saturday, June 22, 2013 at 4:28 PM, Dmitry Gutov wrote:

> On 22.06.2013 11:05, Bozhidar Batsov wrote:
> > > Should we add more, e.g. include,
> > > attr_accessor, using, refine?
> > > 
> > 
> > Yes, I think we should definitely add more. The ones you listed - for
> > sure. We should also add fail (it's a synonym for raise), extend, etc.
> > Btw catch is also a method, not a keyword. loop should also be on the
> > second list, as should be proc and lambda IMO.
> > 
> 
> 
> Ok, also done (except for etc :)), together with other attr* methods, 
> and define_method.
> 
> 

Great! Btw, I now noticed that 'load' is missing from the list. I think that __dir__, __method__ and __callee__ should also be on the list.
> 
> > I'd also suggest adding the "command-like" methods for Kernel that are
> > usually used without an explicit receiver everywhere. There's not that
> > many such commands:
> > 
> > abort
> > at_exit
> > eval
> > exec
> > exit
> > exit!
> > fail
> > fork
> > format
> > p
> > print
> > printf
> > putc
> > puts
> > rand
> > sleep
> > spawn
> > sprintf
> > srand
> > syscall
> > system
> > trap
> > warn
> > 
> 
> 
> I'm less sure about these. Every method on Kernel is usually called 
> without an explicit receiver, and there are more of them.
> Let's wait for another opinion.
> 
> 

There are more of them, but most of them exist only when ruby is invoked with -n/-p (for perl-like scripting) - normally chomp, chomp!, chop, etc are not bound, which means we should not add them to the built-in list, since nobody is actually wring Ruby applications using them. Matz himself recommends that all the command-like methods from Kernel be treated as reserved words - meaning it's considered a bad idea for someone to introduce variables or methods named this way. If they were highlighted properly fewer developers would fail to recognize their "special" status. Looking at the Kernel module's docs there are less than 30 such commands and they've barely changed in recent years.

On a somewhat related matter - I've noticed that in the Ruby spec BEGIN, END, __LINE__, __ENCODING__ and __FILE__ are keywords as well. ruby-mode should highlight them accordingly. 
> 
> > > I'm not so sure about re-implementing it, though. It's easy enough to
> > > install in its current form, no?
> > > 
> > 
> > Sure - my point is that not all Emacs users would know about the
> > package. I'd venture a guess saying most of them won't. The
> > functionality in it seems a perfect fit for ruby-mode. Even if it has to
> > be reimplemented - we're talking about a only a handful of not
> > particularly complex commands.
> > 
> 
> 
> Patches welcome. :)
> 
> Personally, I haven't found myself using ruby-tools too often:
> 
> 1) I don't subscribe to your principle of single quotes vs. double 
> quotes. So, when I'm adding an interpolation to a string, it's usually 
> double-quoted already.
> 
> 

It's not exactly my principle :-) There are other useful commands there for toggling between a symbol and string and blanking strings at point. The toggling between string and symbol is pretty useful.
> 
> 2) Automatic insertion of curly braces after "#" in strings is annoying 
> when you're actually trying to type "#", for example when writing a 
> method signature. I also disagree with "don't leave out {} around 
> instance and global variables".
> 
> But as optional commands with less invasive bindings ("C-c #"?), they 
> would be fine.
> 
> 

Yep, I dislike the current behavior as well. Having it bound to a command that should be invoked manually would be much better indeed.

Btw, Dmitry, I noticed something strange about ruby-mode (at least in 24.3) - the calculations for method and block boundaries seem to be off. I'm not sure if you're aware of the problem or you need a more detailed report.

[-- Attachment #2: Type: text/html, Size: 5489 bytes --]

  parent reply	other threads:[~2013-06-23  6:20 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21 16:00 Small improvements to ruby-mode Bozhidar Batsov
2013-06-21 19:10 ` Stefan Monnier
2013-06-21 23:31   ` Dmitry Gutov
2013-06-21 23:45     ` Glenn Morris
2013-06-22  0:12       ` Dmitry Gutov
2013-06-22  7:05     ` Bozhidar Batsov
2013-06-22 13:28       ` Dmitry Gutov
2013-06-22 15:30         ` Stefan Monnier
2013-06-23  6:20         ` Bozhidar Batsov [this message]
2013-06-23 12:30           ` Dmitry Gutov
2013-06-24 13:49             ` Bozhidar Batsov
2013-07-01 18:32               ` Dmitry Gutov
2013-07-01 21:41                 ` Bozhidar Batsov
2013-07-01 21:50                   ` Dmitry Gutov
     [not found]                     ` <CAM9Zgm3Uw-TfW9aT7zdA1r=etsb26xAcW7DHJ_7=NfArFE8e5A@mail.gmail.com>
2013-07-02 18:38                       ` Dmitry Gutov
2013-07-03 15:46                         ` Dmitry Gutov
     [not found]                           ` <CAM9Zgm1_Jmn7Z4ZwSkPURAFOdTCURQP-TEDeys0dR4Uqyr8mfw@mail.gmail.com>
2013-07-05 10:30                             ` Dmitry Gutov
2013-07-05 11:08                               ` Stefan Monnier
2013-07-05 11:55                                 ` Dmitry Gutov
2013-07-05 22:18                                   ` Stefan Monnier
2013-07-05 13:01                               ` Bozhidar Batsov
2013-07-05 14:15                                 ` Dmitry Gutov
2013-07-06  5:31                                   ` Bozhidar Batsov
2013-07-06  9:37                                     ` Dmitry Gutov
2013-07-06 12:23                                       ` Bozhidar Batsov
2013-07-06 15:47                                         ` Dmitry Gutov
2013-07-07 21:56                                     ` Stefan Monnier
2013-07-07 23:22                                       ` Dmitry Gutov
2013-07-08  9:22                                         ` Stefan Monnier
2013-07-09  0:40                                           ` Dmitry Gutov
2013-07-09  8:50                                             ` Stefan Monnier
2013-07-09 12:57                                             ` Bozhidar Batsov
2013-07-08  9:33                                       ` Bozhidar Batsov
2013-07-08  9:37                                         ` Bozhidar Batsov
2013-07-09  1:19                                           ` Dmitry Gutov
2013-07-09 12:55                                             ` Bozhidar Batsov
2013-07-09 14:36                                               ` Bozhidar Batsov
2013-07-09 16:07                                                 ` Bozhidar Batsov
2013-07-09 17:18                                                   ` Dmitry Gutov
2013-07-10  6:23                                                     ` Bozhidar Batsov
2013-07-09 17:09                                                 ` Dmitry Gutov
2013-07-10  6:09                                                   ` Bozhidar Batsov
2013-07-10 18:09                                                     ` Dmitry Gutov
2013-07-11 11:23                                                       ` Bozhidar Batsov
2013-07-12 20:31                                                         ` Dmitry Gutov
     [not found]                                                           ` <CAM9Zgm2NbtNkm8p+SL=kYd-u90r5ELTvJrj4rxm8_Yk5QVN4WA@mail.gmail.com>
2013-07-13 10:24                                                             ` Bozhidar Batsov
2013-07-13 19:10                                                             ` Dmitry Gutov
2013-07-15 13:53                                                               ` Bozhidar Batsov
2013-07-16 13:18                                                                 ` Bozhidar Batsov
2013-07-16 14:47                                                                   ` Dmitry Gutov
2013-08-08 15:56                                                                     ` Bozhidar Batsov
2013-08-08 21:21                                                                       ` Dmitry Gutov
2013-08-08 22:47                                                                         ` Stefan Monnier
2013-08-08 23:54                                                                           ` Dmitry Gutov
2013-08-09 14:52                                                                             ` Stefan Monnier
2013-08-10 11:45                                                                               ` Dmitry Gutov
2013-08-10 13:23                                                                                 ` Stefan Monnier
2013-08-11 11:54                                                                                 ` Bozhidar Batsov
2013-08-11 13:08                                                                                   ` Dmitry Gutov
2013-08-11 14:08                                                                                     ` Johan Andersson
2013-08-11 14:29                                                                                       ` Dmitry Gutov
2013-08-11 15:18                                                                                         ` Johan Andersson
2013-08-11 16:56                                                                                           ` Stefan Monnier
2013-08-11 20:55                                                                                             ` Johan Andersson
2013-08-12  1:52                                                                                               ` Stefan Monnier
2013-09-13  9:10                                                                                                 ` Bozhidar Batsov
2013-09-13  9:26                                                                                                   ` Johan Andersson
2013-09-13 13:24                                                                                                     ` Stefan Monnier
2013-09-13 13:27                                                                                                       ` Johan Andersson
2013-07-05 22:35                                 ` Stefan Monnier
2013-07-06  5:14                                   ` Bozhidar Batsov
2013-07-06  9:38                                     ` Dmitry Gutov

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=A5EEB3F6E32A4FFE86A35B9802F9960F@gmail.com \
    --to=bozhidar@batsov.com \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).