unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: gento <gento_distefano@hotmail.com>
To: help-gnu-emacs@gnu.org
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)	[thread overview]
Message-ID: <a9b54254-9b71-4a85-9668-e5af8917f579@q11g2000yqi.googlegroups.com> (raw)

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	other threads:[~2009-07-15 11:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-15 11:37 gento [this message]
2009-07-15 23:51 ` How to enable the syntax highlighting for comments within files having a specific extension? Xah Lee
2009-07-16 13:13   ` bj
2009-07-17  1:14     ` Xah Lee
2009-08-27 22:22     ` A.Politz
2009-08-27 20:57 ` pjb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a9b54254-9b71-4a85-9668-e5af8917f579@q11g2000yqi.googlegroups.com \
    --to=gento_distefano@hotmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).