Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Need some help setting up ruby mode

Reply
Thread Tools

Need some help setting up ruby mode

 
 
francisrammeloo@hotmail.com
Guest
Posts: n/a
 
      08-10-2005
Hi all,

I'm an emacs newbie but would like to use the editor for ruby coding.

I have downloaded "ruby-mode.el" and I don't know what to do with it!

I worked my way through the emacs built-in tutorial. I know how to use
modes, but I can't find any information about how to ADD modes to
emacs.

I understand that this may be difficult to explain on the newsgroup.
Any link to helpful information is welcome too!


Best regards,
Francis


PS: Perhaps my basic question is: how do I set up emacs for ruby coding?

 
Reply With Quote
 
 
 
 
Jim Menard
Guest
Posts: n/a
 
      08-10-2005
wrote:
> Hi all,
>
> I'm an emacs newbie but would like to use the editor for ruby coding.
>
> I have downloaded "ruby-mode.el" and I don't know what to do with it!
>
> I worked my way through the emacs built-in tutorial. I know how to use
> modes, but I can't find any information about how to ADD modes to
> emacs.
>
> I understand that this may be difficult to explain on the newsgroup.
> Any link to helpful information is welcome too!


Put ruby-mode.el somewhere where Emacs can find it. I have a directory where
I put that kind of thing, "~/lib/elisp". In my .emacs file I added

(add-to-list 'load-path "~/lib/elisp")

so it can find all of my .el files. Next, add

(autoload 'ruby-mode "ruby-mode" "Ruby mode" t nil)
(autoload 'inf-ruby "inf-ruby" "Ruby inferior process (irb)" t nil)
(setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
interpreter-mode-alist))
(setq auto-mode-alist
(append '(("\\.rbw?$" . ruby-mode)
("\\.rhtml$" . html-mode)
("\\.gem\\(spec\\)?$" . ruby-mode)
("[Rr]akefile" . ruby-mode))
auto-mode-alist))

and optionally a ruby-mode-hook for yourself. Here is a subset of mine:

(setq ruby-mode-hook
(lambda ()
(define-key ruby-mode-map "\r" 'newline-and-indent)
(define-key ruby-mode-map "\M-\C-h" 'backward-kill-word)
(setq c-tab-always-indent nil)
(abbrev-mode t)
(font-lock-mode 1)))

Jim
--
Jim Menard, , http://www.io.com/~jimm
"I am sure that like Java, [C#] will be a 'no pointer' language, where the
most common runtime error will be a 'NULL pointer exception'."
-- Jerry Kott, in comp.lang.smalltalk


 
Reply With Quote
 
 
 
 
francisrammeloo@hotmail.com
Guest
Posts: n/a
 
      08-10-2005
I can find my emacs file. Am I supposed to create it myself? I'm using
Windows XP and GNU Emacs 21.3.1.

 
Reply With Quote
 
Jim Menard
Guest
Posts: n/a
 
      08-10-2005
wrote:
> I can find my emacs file. Am I supposed to create it myself? I'm using
> Windows XP and GNU Emacs 21.3.1.
>
>


I set the environment variable HOME to point to my home directory, then I
created the file .emacs in that directory. If you don't use HOME, then I
think you need to put .emacs in the emacs-XX.Y directory itself.

Jim
--
Jim Menard, , http://www.io.com/~jimm
"I am sure that like Java, [C#] will be a 'no pointer' language, where the
most common runtime error will be a 'NULL pointer exception'."
-- Jerry Kott, in comp.lang.smalltalk


 
Reply With Quote
 
francisrammeloo@hotmail.com
Guest
Posts: n/a
 
      08-10-2005
Ok I found out that I can create a file called _emacs in C:\
Emacs now reads this file at startup.

Thank you Jim, I copy/pasted the lisp code you posted and now I can
select "M-x ruby-mode".

The problem now is that this doesn't change anything. There is no
syntax highlighting.

Is there something missing?

 
Reply With Quote
 
Jim Menard
Guest
Posts: n/a
 
      08-10-2005
wrote:
> Ok I found out that I can create a file called _emacs in C:\
> Emacs now reads this file at startup.
>
> Thank you Jim, I copy/pasted the lisp code you posted and now I can
> select "M-x ruby-mode".
>
> The problem now is that this doesn't change anything. There is no
> syntax highlighting.
>
> Is there something missing?


(global-font-lock-mode t) ; always turn on, where available

; Provide "M-x flfb" as a shortcut
(defalias 'flfb 'font-lock-fontify-buffer)


Jim
--
Jim Menard, , http://www.io.com/~jimm
"I am sure that like Java, [C#] will be a 'no pointer' language, where the
most common runtime error will be a 'NULL pointer exception'."
-- Jerry Kott, in comp.lang.smalltalk


 
Reply With Quote
 
francisrammeloo@hotmail.com
Guest
Posts: n/a
 
      08-10-2005
Thanks Jim, it works now!


Best regards,
Francis

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mmm-mode, python-mode and doctest-mode? Edward Loper Python 0 08-09-2007 05:40 AM
re: mmm-mode, python-mode and doctest-mode? John J Lee Python 0 08-07-2007 07:49 PM
re: mmm-mode, python-mode and doctest-mode? Edward Loper Python 0 08-07-2007 08:58 AM
mmm-mode, python-mode and doctest-mode? John J Lee Python 3 12-01-2005 08:35 PM
Safe Mode (?) - It is meant to be normal mode but looks like safe mode English Patient Computer Support 3 10-03-2004 11:10 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57