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:
(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))