PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > Emacs highlighting, keywords
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Emacs highlighting, keywords

Réponse
 
LinkBack Outils de la discussion
Vieux 04/11/2007, 12h45   #1
rolf.andreassen@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Emacs highlighting, keywords

Hi,

I'm a new user trying to set up a Ruby dev environment. I've gotten to
the point where emacs is willing to highlight some syntax, but not all.
Specifically, I get strings in grey and comments in red, but keywords
('class', 'def', 'end') stay stubbornly black, as do class and variable
names. Keywords do get highlighted in .C files, so it does not seem to
be a global emacs issue.

I wonder if the issue can be that font-lock-defaults is not getting
defined properly, for its value is nil in my test.rb file. Can anyone
me understand how to get it properly set?

Background information: I am using GNU Emacs 21.3.1
(i386-mingw-nt5.1.2600), on Windows XP, and Ruby version 1.8.6. I am
loading ruby mode with the following lines in my .emacs:

(setq load-path (append load-path
'("D:/ruby/doc/ruby/ruby-1.8.6/misc")))
(autoload 'ruby-mode "ruby-mode" "Major mode for editing ruby scripts."
t)
(setq auto-mode-alist (cons '("\\.rb$" . ruby-mode) auto-mode-alist))
(setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
interpreter-mode-alist))


Thanks,

Rolf Andreassen.
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 04/11/2007, 15h15   #2
Rob@AgileConsultingLLC.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Emacs highlighting, keywords


On Nov 4, 2007, at 7:45 AM, Rolf Andreassen wrote:

> Hi,
>
> I'm a new user trying to set up a Ruby dev environment. I've gotten to
> the point where emacs is willing to highlight some syntax, but not
> all.
> Specifically, I get strings in grey and comments in red, but keywords
> ('class', 'def', 'end') stay stubbornly black, as do class and
> variable
> names. Keywords do get highlighted in .C files, so it does not seem to
> be a global emacs issue.
>
> I wonder if the issue can be that font-lock-defaults is not getting
> defined properly, for its value is nil in my test.rb file. Can anyone
> me understand how to get it properly set?
>
> Background information: I am using GNU Emacs 21.3.1
> (i386-mingw-nt5.1.2600), on Windows XP, and Ruby version 1.8.6. I am
> loading ruby mode with the following lines in my .emacs:
>
> (setq load-path (append load-path
> '("D:/ruby/doc/ruby/ruby-1.8.6/misc")))
> (autoload 'ruby-mode "ruby-mode" "Major mode for editing ruby
> scripts."
> t)
> (setq auto-mode-alist (cons '("\\.rb$" . ruby-mode) auto-mode-alist))
> (setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
> interpreter-mode-alist))
>
>
> Thanks,
>
> Rolf Andreassen.


I set these font faces before I autoload the ruby-mode. It's old
'cause I've been using Emacs for a looong time, but my keywords in
ruby-mode are now cyan (and have been for ages so I have no clue what
they were normally). I use a black background so you may have to
change some of the colors if you prefer a light background.

(require 'font-core)
(require 'font-lock)

(setq font-lock-maximum-decoration t)
(global-font-lock-mode t nil) ; this is what I want! (8/26/01)

(setq font-lock-face-attributes
(list
'(font-lock-comment-face "firebrick" nil nil nil nil)
'(font-lock-function-name-face "orange" nil nil nil nil)
'(font-lock-keyword-face "cyan" nil nil nil nil)
;; '(font-lock-reference-face "red" nil nil nil nil)
'(font-lock-string-face "blue" nil nil nil nil)
'(font-lock-type-face "magenta" nil nil nil nil)
'(font-lock-variable-name-face "green" nil nil nil nil)
))


I also have this bit (probably from a couple years ago) that, I think,
shows a better way to set fonts that are at least minimally aware of
the lightness or darkness of the background. (e.g., the '(background
light) list)

(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.
'(cperl-array ((((class color) (background light)) (:background
"lightyellow2" :foreground "Blue"))))
'(cperl-hash ((((class color) (background light)) (:background
"lightyellow2" :foreground "Red" :slant italic))))
)


-Rob

Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com



  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h01.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10012 seconds with 10 queries