unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* [Newbie] Colorizing keywords
@ 2003-04-23 17:46 Robert Pollard
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Pollard @ 2003-04-23 17:46 UTC (permalink / raw)


Hello all,

Is there a way to define the colors that are used for keywords in a 
document?  For example, if I am editing an HTML document I want the 
keywords colorized instead of just plain black and white.  I know there 
is an HTML mode but it doesn't colorize anything.  Can I change the 
colors to indicate what colors I want if there is a predefined color 
scheme for a particular mode?

If there is a way to turn on colorization in HTML mode I would 
appreciate someone letting me know how this works.

I am working in Cygwin and Emacs version 21.2.1.

Thanks in advance for any time you use to help me with,


Robert Pollard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Newbie] Colorizing keywords
       [not found] <mailman.5118.1051120111.21513.help-gnu-emacs@gnu.org>
@ 2003-04-23 17:54 ` Phillip Lord
  2003-04-23 18:10 ` Martin Stemplinger
  1 sibling, 0 replies; 6+ messages in thread
From: Phillip Lord @ 2003-04-23 17:54 UTC (permalink / raw)


>>>>> "Robert" == Robert Pollard <rpollard@apple.com> writes:

  Robert> Hello all,

  Robert> Is there a way to define the colors that are used for
  Robert> keywords in a document?  For example, if I am editing an
  Robert> HTML document I want the keywords colorized instead of just
  Robert> plain black and white.  I know there is an HTML mode but it
  Robert> doesn't colorize anything.  Can I change the colors to
  Robert> indicate what colors I want if there is a predefined color
  Robert> scheme for a particular mode?

  Robert> If there is a way to turn on colorization in HTML mode I
  Robert> would appreciate someone letting me know how this works.

  Robert> I am working in Cygwin and Emacs version 21.2.1.

  Robert> Thanks in advance for any time you use to help me with,

You just need to turn it on.

There is a check box in the Options menu called "Syntax Highlighting",
which should do the trick. Or you can put "(global-font-lock-mode 1)"
into your .emacs.

There is a detailed description in the FAQ (Help->Faq, then type "i"
(for index) and "syntax" and you should find it). 

Cheers

Phil

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Newbie] Colorizing keywords
       [not found] <mailman.5118.1051120111.21513.help-gnu-emacs@gnu.org>
  2003-04-23 17:54 ` Phillip Lord
@ 2003-04-23 18:10 ` Martin Stemplinger
  2003-04-24 16:41   ` Robert Pollard
  1 sibling, 1 reply; 6+ messages in thread
From: Martin Stemplinger @ 2003-04-23 18:10 UTC (permalink / raw)


On Mi Apr 23 2003 at 19:46, Robert Pollard <rpollard@apple.com> wrote:

> If there is a way to turn on colorization in HTML mode I would
> appreciate someone letting 
> me know how this works.

Do you know about font-lock-mode? C-h a font-lock shows you. You may
also be interested in color-theme, which lets you easily customize
which colors are used.

HTH
Martin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Newbie] Colorizing keywords
  2003-04-23 18:10 ` Martin Stemplinger
@ 2003-04-24 16:41   ` Robert Pollard
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Pollard @ 2003-04-24 16:41 UTC (permalink / raw)
  Cc: help-gnu-emacs

Yes I now know about font-lock thanks to you and Phillip Lord.  This 
takes care of known document types.  What about making my own 
definitions for colorization?  Is it possible to create my own database 
of keywords and define the color that is used for each?  How does 
font-lock-mode do it?  It would have to have a place where the keywords 
and patterns are defined with what colors they should be.  Where would 
this be located so I can figure out how to do my own definitions?  I 
suspect there is Lisp code involved and I can sort of imagine the Lisp 
code that could do what is needed.

Any ideas?

Thanks,

Robert

On Wednesday, April 23, 2003, at 11:10 AM, Martin Stemplinger wrote:

> On Mi Apr 23 2003 at 19:46, Robert Pollard <rpollard@apple.com> wrote:
>
>> If there is a way to turn on colorization in HTML mode I would
>> appreciate someone letting
>> me know how this works.
>
> Do you know about font-lock-mode? C-h a font-lock shows you. You may
> also be interested in color-theme, which lets you easily customize
> which colors are used.
>
> HTH
> Martin
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Newbie] Colorizing keywords
       [not found] <mailman.5158.1051202519.21513.help-gnu-emacs@gnu.org>
@ 2003-04-24 17:06 ` Johan Bockgård
  2003-04-25 10:29 ` Colin Marquardt
  1 sibling, 0 replies; 6+ messages in thread
From: Johan Bockgård @ 2003-04-24 17:06 UTC (permalink / raw)


Robert Pollard <rpollard@apple.com> writes:

> What about making my own definitions for colorization? Is it
> possible to create my own database of keywords and define the color
> that is used for each?
[...]
> Any ideas?

Read the fine manual:

,----[ (info "(emacs)Font Lock") ]
|    Font Lock highlighting patterns already exist for many modes, but you
| may want to fontify additional patterns.  You can use the function
| `font-lock-add-keywords', to add your own highlighting patterns for a
| particular mode.  For example, to highlight `FIXME:' words in C
| comments, use this:
| 
|      (font-lock-add-keywords
|       'c-mode
|       '(("\\<\\(FIXME\\):" 1 font-lock-warning-face t)))
| 
|    To remove keywords from the font-lock highlighting patterns, use the
| function `font-lock-remove-keywords'.
`----

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Newbie] Colorizing keywords
       [not found] <mailman.5158.1051202519.21513.help-gnu-emacs@gnu.org>
  2003-04-24 17:06 ` [Newbie] Colorizing keywords Johan Bockgård
@ 2003-04-25 10:29 ` Colin Marquardt
  1 sibling, 0 replies; 6+ messages in thread
From: Colin Marquardt @ 2003-04-25 10:29 UTC (permalink / raw)


Robert Pollard <rpollard@apple.com> writes:

> Yes I now know about font-lock thanks to you and Phillip Lord.  This
> takes care of known document types.  What about making my own
> definitions for colorization?  Is it possible to create my own
> database of keywords and define the color that is used for each?  

See e.g. http://www.emacswiki.org/cgi-bin/wiki.pl?AddKeywords

HTH,
  Colin

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-04-25 10:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.5158.1051202519.21513.help-gnu-emacs@gnu.org>
2003-04-24 17:06 ` [Newbie] Colorizing keywords Johan Bockgård
2003-04-25 10:29 ` Colin Marquardt
     [not found] <mailman.5118.1051120111.21513.help-gnu-emacs@gnu.org>
2003-04-23 17:54 ` Phillip Lord
2003-04-23 18:10 ` Martin Stemplinger
2003-04-24 16:41   ` Robert Pollard
2003-04-23 17:46 Robert Pollard

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