help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Syntax highlight problem about the ruby-mode in emacs


From: Eric Luo
Subject: Syntax highlight problem about the ruby-mode in emacs
Date: Sat, 11 Mar 2006 12:34:59 +0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (windows-nt)

Hi

I edit ruby script in emacs, but sometimes I just cannot get ruby mode
syntax highlight successfully. I had googled this problem and found
that:
   http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/131654
 >I suspect that most font-lock problems like this are caused by the
 >internal use of ruby-mode-hook in ruby-mode.el. Suppose your .emacs
 >file contains

In my case, I had the following settings in my .emacs file.
(desktop-save-mode 1)
(global-font-lock-mode 1)
(setq font-lock-maximum-decoration t)
(setq font-lock-global-modes '(not text-mode))
(setq font-lock-verbose t)

If there is a opened ruby file the last time I exit the emacs, syntax
highlight will not work as expected.

When C-h v ruby-mode-hook to inspect the value of ruby-mode-hook,
I get the following value:

>ruby-mode-hook's value is shown below.
>
>Not documented as a variable.
>
>Value:
>((lambda nil
>   (inf-ruby-keys))
> turn-on-font-lock)

In the opposite, if I start Emacs without an ruby file opened. I will
get the correct ruby-mode-hook value.

>  ruby-mode-hook's value is shown below.
>
>  Not documented as a variable.
>
>  Value:
>  ((lambda nil
>     (make-local-variable 'font-lock-defaults)
>     (make-local-variable 'font-lock-keywords)
>     (make-local-variable 'font-lock-syntax-table)
>     (make-local-variable 'font-lock-syntactic-keywords)
>     (setq font-lock-defaults
>        '((ruby-font-lock-keywords)
>          nil nil))
>     (setq font-lock-keywords ruby-font-lock-keywords)
>     (setq font-lock-syntax-table ruby-font-lock-syntax-table)
>     (setq font-lock-syntactic-keywords ruby-font-lock-syntactic-keywords))
>   (lambda nil
>     (inf-ruby-keys))
>   turn-on-font-lock)

I want to know what make the difference.

BTW, if the enabled the rails-mode, the synatx highlight function
failed, too.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]