[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ruby-mode.el

Asfand Yar Qazi

2/9/2005 8:41:00 AM

Hi,

Some things about the new ruby-mode.el in Ruby 1.8.2:

font-lock doesn't turn on by default unless I replace the line in
ruby-mode.el that reads (eval-when-compile (require 'cl)) with
(eval-when-compile (require 'cl) (require 'font-lock)). Is this how
it should be?

Ctrl-Q for word-wrapping comments no longer works! It used to word
wrap code as well as comments unless a new-line separated them, which
was junky but still at least it was something. It no longer works now
- what's up? Surely it should be possible to use the comment-wrapping
code from (for example) sh-mode?

Thanks,
Asfand Yar
10 Answers

Yukihiro Matsumoto

2/9/2005 9:14:00 AM

0

Hi,

In message "Re: ruby-mode.el"
on Wed, 9 Feb 2005 17:40:06 +0900, Asfand Yar Qazi <ay1204@qazi.f2s.com> writes:

|font-lock doesn't turn on by default unless I replace the line in
|ruby-mode.el that reads (eval-when-compile (require 'cl)) with
|(eval-when-compile (require 'cl) (require 'font-lock)). Is this how
|it should be?

ruby-mode.el does not always require font-lock, for example, it should
work with hilit19 as well, so that requiring it by eval-when-compile
is not suitable. I personally haven't seen the problem. I'm not sure
how to avoid your problem.

|Ctrl-Q for word-wrapping comments no longer works! It used to word
|wrap code as well as comments unless a new-line separated them, which
|was junky but still at least it was something. It no longer works now
|- what's up? Surely it should be possible to use the comment-wrapping
|code from (for example) sh-mode?

I don't think ruby-mode provides any Ctrl-Q binding, which is reserved
for quoted-insert. Or maybe you meant Meta-Q, which is not modified
by ruby-mode by default. Perhaps it belongs to your personal settings.

matz.


Asfand Yar Qazi

2/10/2005 4:12:00 PM

0

Yukihiro Matsumoto wrote:
> Hi,
>
> In message "Re: ruby-mode.el"
> on Wed, 9 Feb 2005 17:40:06 +0900, Asfand Yar Qazi <ay1204@qazi.f2s.com> writes:
>
> |font-lock doesn't turn on by default unless I replace the line in
> |ruby-mode.el that reads (eval-when-compile (require 'cl)) with
> |(eval-when-compile (require 'cl) (require 'font-lock)). Is this how
> |it should be?
>
> ruby-mode.el does not always require font-lock, for example, it should
> work with hilit19 as well, so that requiring it by eval-when-compile
> is not suitable. I personally haven't seen the problem. I'm not sure
> how to avoid your problem.

It's been a recurring problem for me, actually. I'll see if I can
find a fix, and post it to the group.

>
> |Ctrl-Q for word-wrapping comments no longer works! It used to word
> |wrap code as well as comments unless a new-line separated them, which
> |was junky but still at least it was something. It no longer works now
> |- what's up? Surely it should be possible to use the comment-wrapping
> |code from (for example) sh-mode?
>
> I don't think ruby-mode provides any Ctrl-Q binding, which is reserved
> for quoted-insert. Or maybe you meant Meta-Q, which is not modified
> by ruby-mode by default. Perhaps it belongs to your personal settings.
>
> matz.

Sorry, that should have been Meta-Q. OK, I'll see if my personal
settings are bodged up.

Thanks for the reply (I feel like I've been talking to a celebrity :-)
Asfand Yar

Don Owens

2/10/2005 5:32:00 PM

0

Has a paren-mode kind of thing been considered for ruby-mode where
having the cursor over an "end" would highlight or blink the cursor
over the corresponding "begin", "while", etc. at the beginning of the
block? I think that would be very useful in the case where you have a
lot of blocks ending together, just as it is for many ending braces in
Perl, for example.

Don

On Fri, 11 Feb 2005 01:10:11 +0900, Asfand Yar Qazi <ay1204@qazi.f2s.com> wrote:
> Yukihiro Matsumoto wrote:
> > Hi,
> >
> > In message "Re: ruby-mode.el"
> > on Wed, 9 Feb 2005 17:40:06 +0900, Asfand Yar Qazi <ay1204@qazi.f2s.com> writes:
> >
> > |font-lock doesn't turn on by default unless I replace the line in
> > |ruby-mode.el that reads (eval-when-compile (require 'cl)) with
> > |(eval-when-compile (require 'cl) (require 'font-lock)). Is this how
> > |it should be?
> >
> > ruby-mode.el does not always require font-lock, for example, it should
> > work with hilit19 as well, so that requiring it by eval-when-compile
> > is not suitable. I personally haven't seen the problem. I'm not sure
> > how to avoid your problem.
>
> It's been a recurring problem for me, actually. I'll see if I can
> find a fix, and post it to the group.
>
> >
> > |Ctrl-Q for word-wrapping comments no longer works! It used to word
> > |wrap code as well as comments unless a new-line separated them, which
> > |was junky but still at least it was something. It no longer works now
> > |- what's up? Surely it should be possible to use the comment-wrapping
> > |code from (for example) sh-mode?
> >
> > I don't think ruby-mode provides any Ctrl-Q binding, which is reserved
> > for quoted-insert. Or maybe you meant Meta-Q, which is not modified
> > by ruby-mode by default. Perhaps it belongs to your personal settings.
> >
> > matz.
>
> Sorry, that should have been Meta-Q. OK, I'll see if my personal
> settings are bodged up.
>
> Thanks for the reply (I feel like I've been talking to a celebrity :-)
> Asfand Yar
>
>


--
Don Owens
regexman@gmail.com


Ville Mattila

2/10/2005 5:47:00 PM

0

Don Owens <regexman@gmail.com> writes:

> Has a paren-mode kind of thing been considered for ruby-mode where
> having the cursor over an "end" would highlight or blink the cursor
> over the corresponding "begin", "while", etc. at the beginning of the
> block? I think that would be very useful in the case where you have a
> lot of blocks ending together, just as it is for many ending braces in
> Perl, for example.
>
> Don
>

Arachno ruby 0.4 has very good feature (control-d control-m) that shows
matching end very clearly. Also it has identitation lines ala scite
so you'll understand code much quicker.

- Ville

Ben Giddings

2/10/2005 6:53:00 PM

0

Does the new ruby-mode.el handle indentation of hanging um... whatsits
better?

What I mean is when I have code like so:

if (foo)
puts("This string is too long for one line, " +
"so I'm splitting it into two for readability")
end

That's how I want it indented. However, ruby-mode seems to want to
indent the continued line (starting with "so ...") so that instead of
the quotes lining up, instead ruby-mode wants to indent the second line
so that it continues after the + as in:

if (foo)
puts("This string is too long for one line, " +
"so I'm splitting it
into two for readability")
end

That's not what I'd expect at all, and not how Emacs handles this sort
of situation in the other modes I use. Does anybody know why it is this
way, and how to make it the way I want it to be?

Ben


George Ogata

2/10/2005 9:07:00 PM

0

Ben Giddings <bg-rubytalk@infofiend.com> writes:

> Does the new ruby-mode.el handle indentation of hanging um... whatsits
> better?
>
> What I mean is when I have code like so:
>
> if (foo)
> puts("This string is too long for one line, " +
> "so I'm splitting it into two for readability")
> end
>
> That's how I want it indented. However, ruby-mode seems to want to
> indent the continued line (starting with "so ...") so that instead of
> the quotes lining up, instead ruby-mode wants to indent the second line
> so that it continues after the + as in:
>
> if (foo)
> puts("This string is too long for one line, " +
> "so I'm splitting it
> into two for readability")
> end
>
> That's not what I'd expect at all, and not how Emacs handles this sort
> of situation in the other modes I use. Does anybody know why it is this
> way, and how to make it the way I want it to be?

The latest version does it a bit better:

if foo
puts('foo' +
'bar' +
'baz')
end

Not exactly what you want, but probably intentional. You can get the
latest version from CVS. The misc/ directory. Online at:

http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/...

Ben Giddings

2/10/2005 9:30:00 PM

0

George Ogata wrote:
> The latest version does it a bit better:
>
> if foo
> puts('foo' +
> 'bar' +
> 'baz')
> end
>
> Not exactly what you want, but probably intentional. You can get the
> latest version from CVS. The misc/ directory. Online at:

If the strings are longer than "foo" does it still start 2 (or maybe
whatever your basic-indent setting is) spaces in? Or is the space
relative to the position of the +?

I can live with an extra indentation, but not with:

"foo is the Foo" +
"bar is the Bar"

Ben



George Ogata

2/10/2005 9:38:00 PM

0

Ben Giddings <bg-rubytalk@infofiend.com> writes:

> If the strings are longer than "foo" does it still start 2 (or maybe
> whatever your basic-indent setting is) spaces in?

Yes.

> Or is the space relative to the position of the +?

No.

Brian Schröder

2/11/2005 12:34:00 AM

0

On Fri, 11 Feb 2005 06:30:16 +0900
Ben Giddings <bg-rubytalk@infofiend.com> wrote:

> George Ogata wrote:
> > The latest version does it a bit better:
> >
> > if foo
> > puts('foo' +
> > 'bar' +
> > 'baz')
> > end
> >
> > Not exactly what you want, but probably intentional. You can get the
> > latest version from CVS. The misc/ directory. Online at:
>
> If the strings are longer than "foo" does it still start 2 (or maybe
> whatever your basic-indent setting is) spaces in? Or is the space
> relative to the position of the +?
>
> I can live with an extra indentation, but not with:
>
> "foo is the Foo" +
> "bar is the Bar"
>
> Ben
>
>
While we are at it, is it possible to make xemacs always indent arrays as if they were contained in brackets?

This is how ruby-mode indents:

foo_bar_baz = [1, 2, 3, 4,
5, 6, 7, 8]

foo_bar_baz = ([1, 2, 3, 4,
5, 6, 7, 8])

This is what I want:

foo_bar_baz = [1, 2, 3, 4,
5, 6, 7, 8]

regards,

Brian


Guillaume Marcais

2/11/2005 2:25:00 PM

0

On Fri, 2005-02-11 at 09:34 +0900, Brian Schröder wrote:
> > Ben
> >
> >
> While we are at it, is it possible to make xemacs always indent arrays as if they were contained in brackets?
>
> This is how ruby-mode indents:
>
> foo_bar_baz = [1, 2, 3, 4,
> 5, 6, 7, 8]
>
> foo_bar_baz = ([1, 2, 3, 4,
> 5, 6, 7, 8])
>
> This is what I want:
>
> foo_bar_baz = [1, 2, 3, 4,
> 5, 6, 7, 8]

+1

Guillaume.