[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

syntax highlight problem about the ruby-mode in emacs

Eric Luo

3/11/2006 3:05:00 AM

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-t...
>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.



Eric
6 Answers

Steve Smith

9/1/2006 6:55:00 PM

0

I have the same problem.

I have the following files in my site-lisp folder:

C:\emacs\site-lisp\find-recursive.el
C:\emacs\site-lisp\psvn.el
C:\emacs\site-lisp\snippet.el
C:\emacs\site-lisp\subdirs.el
C:\emacs\site-lisp\emacs-rails\ChangeLog
C:\emacs\site-lisp\emacs-rails\rails-core.el
C:\emacs\site-lisp\emacs-rails\rails-for-controller.el
C:\emacs\site-lisp\emacs-rails\rails-for-layout.el
C:\emacs\site-lisp\emacs-rails\rails-for-rhtml.el
C:\emacs\site-lisp\emacs-rails\rails-lib.el
C:\emacs\site-lisp\emacs-rails\rails-navigation.el
C:\emacs\site-lisp\emacs-rails\rails-ruby.el
C:\emacs\site-lisp\emacs-rails\rails-scripts.el
C:\emacs\site-lisp\emacs-rails\rails-ui.el
C:\emacs\site-lisp\emacs-rails\rails-webrick.el
C:\emacs\site-lisp\emacs-rails\rails.el
C:\emacs\site-lisp\emacs-rails\README
C:\emacs\site-lisp\ruby\inf-ruby.el
C:\emacs\site-lisp\ruby\README
C:\emacs\site-lisp\ruby\ruby-electric.el
C:\emacs\site-lisp\ruby\ruby-mode.el
C:\emacs\site-lisp\ruby\rubydb2x.el
C:\emacs\site-lisp\ruby\rubydb3x.el

And here is my .emacs file:

(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(cua-mode t nil (cua-base))
'(debug-on-error t)
'(global-font-lock-mode t nil (font-core))
'(show-paren-mode nil)
'(transient-mark-mode t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

;;(autoload 'ruby-mode "ruby-mode" "Load ruby-mode")
;;(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
;; uncomment the next line if you want syntax highlighting
;;(add-hook 'ruby-mode-hook 'turn-on-font-lock)

(defun try-complete-abbrev (old)
(if (expand-abbrev) t nil))

(setq hippie-expand-try-functions-list
'(try-complete-abbrev
try-complete-file-name
try-expand-dabbrev))

(require 'rails)

--
Posted via http://www.ruby-....

Heinrich

9/25/2013 3:44:00 PM

0

In article <l1uvpf$u6d$1@news.mixmin.net>,
The shiteating, forging limey bastard "Revd" wrote:

[nothing important]

hello my english friend are you stilll raping children?

HQ

9/25/2013 3:53:00 PM

0

On Wed, 25 Sep 2013 15:43:32 +0000 (UTC), "Heinrich"
<Heinrich@Ruhrgasnett.de> wrote:

>In article <l1uvpf$u6d$1@news.mixmin.net>,
>The shiteating, forging limey bastard "Revd" wrote:
>
>[nothing important]
>
>hello my english friend are you stilll raping children?

Hello, fellow jew, are you still assisting in child genital
mutilations for a living?

CUNTICA

9/25/2013 3:55:00 PM

0

''Help Hitler get his mustache back!'' Awh, isn't the piss - bum Gooooooooran Radavich wearing his ''Stinky Hitler'' mustache today?

Well stick your finger up your greasy - arse bumhole & smear away.....

Heinrich

9/25/2013 4:11:00 PM

0

you have some nerve you english bastard... kill yourself
like the otherr english bastards

english bastards kill themselves in great numbers

http://tinyurl.c...
"About 1,000 more people killed themselves between 2008 and 2010 than
would have been expected if previous trends had continued, according
to researchers at the University of Liverpool, the University of
Cambridge and the London School of Hygiene and Tropical Medicine.
The British Medical Journal published the study today."

limey Falklands veterans kill themselves:
http://www.dailymail.co.uk/news/article-94492/Suicide-Falklands-vet...

More limey soldiers kill themselves than are killed in the war:
http://www.theday.co.uk/health/suicide-more-deadly-than-taliban-for-u...

The Peeler

9/25/2013 4:25:00 PM

0

On Wed, 25 Sep 2013 17:38:26 +0200, the Dutch pig oinked:

>
>> What's up friend?
>
> Whassup, jewboi?
>
>> Any luck in marrying off my 'tarded, ugly, circumcised jew daughter?
>
> Nope! LOL
>
> what kind of people do live in kansas?

As in EVERY place around the world: ONLY people that are a LOT smarter than
you, Dumb Heini!


--
Dumb Heini about himself: "i was diagnozed with the syndromeof asperger, no
idea what it means but i am feelingperfectly oke"
MID: <7u8b41FjtnU1@mid.individual.net>