Forum: Ruby EMACS with ruby-mode

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Felix E. Klee (Guest)
on 2007-07-30 17:06
(Received via mailing list)
I'm using EMACS' ruby-mode, and with the following code, "x += 3" gets
highlighted as if it was a string.

  puts %{it's annoying}
  x = 3 + 5

Does anyone know a quick workaround/solution? Is there some Ruby mode
for EMACS that doesn't have this problem?
Michael G. (Guest)
on 2007-07-30 18:16
(Received via mailing list)
On Jul 30, 2007, at 8:05 , Felix E. Klee wrote:

> I'm using EMACS' ruby-mode, and with the following code, "x += 3" gets
> highlighted as if it was a string.
>
>   puts %{it's annoying}
>   x = 3 + 5

I've found there are a number of syntax highlighting quirks with Ruby
mode. I'd love to hear a solution as well. I haven't yet dug into the
code myself.

Michael G.
grzm seespotcode net
Felix E. Klee (Guest)
on 2007-07-30 18:42
(Received via mailing list)
At Mon, 30 Jul 2007 15:04:19 +0200,
Felix E. Klee wrote:
> Does anyone know a quick workaround/solution?

As a workaround, I now do:

  a = "'"
  puts %{it#{a}s annoying}
  x = 3 + 5

It's not nice, but the broken syntax highlighting is worse, especially
when one uses %{...} all over the place.
Lionel B. (Guest)
on 2007-07-30 19:11
(Received via mailing list)
Felix E. Klee wrote the following on 30.07.2007 15:05 :
> I'm using EMACS' ruby-mode, and with the following code, "x += 3" gets
> highlighted as if it was a string.
>
>   puts %{it's annoying}
>   x = 3 + 5
>
> Does anyone know a quick workaround/solution? Is there some Ruby mode
> for EMACS that doesn't have this problem?
>

None that I'm aware of, but you can try:

puts %{it's annoying} #' yes it is
Ryan D. (Guest)
on 2007-07-31 20:47
(Received via mailing list)
On Jul 30, 2007, at 06:05 , Felix E. Klee wrote:

> I'm using EMACS' ruby-mode, and with the following code, "x += 3" gets
> highlighted as if it was a string.
>
>   puts %{it's annoying}
>   x = 3 + 5

puts %{it\'s annoying}
x = 3 + 5

or Lionel's suggestion:

puts %{it's annoying} # '
x = 3 + 5

If my elisp-fu were stronger, I'd fix it, but I'm not so good on the
emacs syntax table side of things. Especially a monster like ruby.
Felix E. Klee (Guest)
on 2007-07-31 22:12
(Received via mailing list)
At Wed, 1 Aug 2007 01:46:26 +0900,
Ryan D. wrote:
> puts %{it\'s annoying}

I like that - thanks for the suggestion!
This topic is locked and can not be replied to.