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

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

How to enable the syntax highlighting for comments within files having


From: gento
Subject: How to enable the syntax highlighting for comments within files having a specific extension?
Date: Wed, 15 Jul 2009 04:37:30 -0700 (PDT)
User-agent: G2/1.0

Hi All,

I'm using emacs to edit journal text files *.jou, for which the
commented lines
starts with the character "/".

I got two working solutions to have emacs recognize the "*.jou" files
and
apply the corresponding comment syntax automatically.

Namely I add to the .emacs file either

(require 'cl)
(push '("\\.jou$" . (lambda () (text-mode) (setf comment-start "/")))
auto-mode-alist)

or

(add-hook 'find-file-hooks
 (lambda ()
  (when (string-match "\\.jou$" (buffer-file-name))
   (setq comment-start "/")
  )
 )
)

For the moment I'm using the latter macro.


Now I would also like to enable the syntax highlighting for comments.

Does anybody know how I can modify one of the previous code snippets
in order to turn the text of the commented lines into red ?

I appreciate any help.


reply via email to

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