# EMACS with ruby-mode

**URL:** <https://www.ruby-forum.com/t/emacs-with-ruby-mode/110740>\
**Category:** Ruby\
**Created:** [July 30, 2007, 3:06pm UTC](https://www.ruby-forum.com/t/emacs-with-ruby-mode/110740 "2007-07-30T15:06:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Felix\_ESKlee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3ec8ea/32.png) [@Felix\_ESKlee](https://www.ruby-forum.com/u/Felix_ESKlee)\
**Post date:** [July 30, 2007, 3:06pm UTC](https://www.ruby-forum.com/t/emacs-with-ruby-mode/110740/1 "2007-07-30T15:06:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Felix\_ESKlee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3ec8ea/32.png) [@Felix\_ESKlee](https://www.ruby-forum.com/u/Felix_ESKlee)\
**Post date:** [July 30, 2007, 4:16pm UTC](https://www.ruby-forum.com/t/emacs-with-ruby-mode/110740/2 "2007-07-30T16:16:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Felix\_ESKlee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3ec8ea/32.png) [@Felix\_ESKlee](https://www.ruby-forum.com/u/Felix_ESKlee)\
**Post date:** [July 30, 2007, 4:42pm UTC](https://www.ruby-forum.com/t/emacs-with-ruby-mode/110740/3 "2007-07-30T16:42:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Felix\_ESKlee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3ec8ea/32.png) [@Felix\_ESKlee](https://www.ruby-forum.com/u/Felix_ESKlee)\
**Post date:** [July 30, 2007, 5:11pm UTC](https://www.ruby-forum.com/t/emacs-with-ruby-mode/110740/4 "2007-07-30T17:11:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Felix\_ESKlee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3ec8ea/32.png) [@Felix\_ESKlee](https://www.ruby-forum.com/u/Felix_ESKlee)\
**Post date:** [July 31, 2007, 8:12pm UTC](https://www.ruby-forum.com/t/emacs-with-ruby-mode/110740/5 "2007-07-31T20:12:25Z")

</div>

At Wed, 1 Aug 2007 01:46:26 +0900,  
Ryan D. wrote:

> puts %{it’s annoying}

I like that - thanks for the suggestion!

---

<div class="post-metadata">

**Author:** ![Felix\_ESKlee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3ec8ea/32.png) [@Felix\_ESKlee](https://www.ruby-forum.com/u/Felix_ESKlee)\
**Post date:** [July 31, 2007, 6:47pm UTC](https://www.ruby-forum.com/t/emacs-with-ruby-mode/110740/6 "2007-07-31T18:47:14Z")

</div>

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.
