简体   繁体   中英

Emacs updating ruby major mode

I am using emacs 23.1, with the included major mode for ruby. This regular expression syntax highlighting bug is driving me crazy: http://redmine.ruby-lang.org/issues/show/4242

As noted, the bug was fixed in a newer version of ruby-mode.el
I would like to update to this newer version of ruby-mode.el. What is the best method to do this?

What I tried:
1. I installed ruby 1.9.2-p180
2. I verified /ruby-1.9.2-p180/misc/ruby-mode.el was the fixed version
3. I copied it into.emacs.d
4. In my.emacs file I added:

(autoload 'ruby-mode "ruby-mode" "Ruby Mode." t)
(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))

However, the bug is not fixed:(

Any help is appreciated, thank you. Also, if anyone knows, is this fixed in emacs 23.2 or 23.3?

EDIT: Okay, it turns out it is correctly reading the new ruby-mode.el -- I renamed ruby-mode.elc to ruby-mode.elc2 to make sure this was the case.

Perhaps this is a new edge case, I'm going to file a bug report soon.
Here is the test case for anyone curious

method /^"([^"]*)"$/ do |arg|

It appears to work correctly with () surrounding the method argument, so that will be my fix for now:)

Try adding explicit path to autoload:

(autoload 'ruby-mode "~/.emacs.d/ruby-mode" "Ruby Mode." t)

By the way, if you want to know what file is loaded emacs library in, use Mx locate-library .

Try copying ruby-mode.el to ~/.emacs.d/load/ instead of ~/.emacs.d/ . That fixed the problem for me.

I think emacs probably looks in ~/.emacs.d/load/ and if it doesn't find the file there it will look elsewhere. On my system, Ubuntu 10.04, I think it was finding it in /usr/share/emacs/23.1/lisp/progmodes/ruby-mode.elc .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM