unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How can I make emacs highlight the first word of every line a particular color?
@ 2007-10-17 22:00 russell.friesenhahn
  2007-10-18  3:58 ` aartist
  2007-10-24  1:33 ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: russell.friesenhahn @ 2007-10-17 22:00 UTC (permalink / raw)
  To: help-gnu-emacs

I'm scripting in tcl and if emacs font lock doesn't recognize the
first word of a line as a tcl reserved word, I'd like it to highlight
it as something else since it is ~98% of the time a user-defined proc
name that I wrote.  Thanks for the help in advance!

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

* Re: How can I make emacs highlight the first word of every line a particular color?
  2007-10-17 22:00 How can I make emacs highlight the first word of every line a particular color? russell.friesenhahn
@ 2007-10-18  3:58 ` aartist
  2007-10-24  1:33 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: aartist @ 2007-10-18  3:58 UTC (permalink / raw)
  To: help-gnu-emacs

On Oct 17, 6:00 pm, russell.friesenh...@gmail.com wrote:
> I'm scripting in tcl and if emacs font lock doesn't recognize the
> first word of a line as a tcl reserved word, I'd like it to highlight
> it as something else since it is ~98% of the time a user-defined proc
> name that I wrote.  Thanks for the help in advance!

You can use M-x highlight-regexp
Regexp to highlight: ^\(\w+\)

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

* Re: How can I make emacs highlight the first word of every line a particular color?
  2007-10-17 22:00 How can I make emacs highlight the first word of every line a particular color? russell.friesenhahn
  2007-10-18  3:58 ` aartist
@ 2007-10-24  1:33 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2007-10-24  1:33 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> "russell" == russell friesenhahn <russell.friesenhahn@gmail.com> writes:

> I'm scripting in tcl and if emacs font lock doesn't recognize the
> first word of a line as a tcl reserved word, I'd like it to highlight
> it as something else since it is ~98% of the time a user-defined proc
> name that I wrote.  Thanks for the help in advance!

Try something like:

   (add-hook 'tcl-mode-hook
             (lambda ()
               (font-lock-add-keywords
                nil '(("^[^ \t\n]+" . font-lock-keyword-face)))))


-- Stefan

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

end of thread, other threads:[~2007-10-24  1:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-17 22:00 How can I make emacs highlight the first word of every line a particular color? russell.friesenhahn
2007-10-18  3:58 ` aartist
2007-10-24  1:33 ` Stefan Monnier

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