all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* keyword highlighting
@ 2004-09-09 21:26 Dan Boitnott
  2004-09-10 12:43 ` ken
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Boitnott @ 2004-09-09 21:26 UTC (permalink / raw)


I'm adding keyword highlighting to a new major mode I'm writing.  I'm 
having trouble getting one type to work.  I'd like to set any line that 
begins with "vms " to font-lock-constant face.  I thought something 
like this should work:

  ("^VMS.*$" . font-lock-constant-face)

But the lines don't highlight at all.  If I do:

("^VMS" . font-lock-constant-face)

the "VMS" is colored but the rest of the line isn't.  If I do this:

("^VMS...." . font-lock-constant-face)

the "VMS" and four characters after are colored.  This suggests the 
caret and the period are working as expected.  Is the engine matching 
un-greedily?  Any help would be appriciated.

Thanks,
Dan

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

* Re: keyword highlighting
  2004-09-09 21:26 keyword highlighting Dan Boitnott
@ 2004-09-10 12:43 ` ken
  0 siblings, 0 replies; 3+ messages in thread
From: ken @ 2004-09-10 12:43 UTC (permalink / raw)


Dan Boitnott wrote:

> I'm adding keyword highlighting to a new major mode I'm writing.  I'm 
> having trouble getting one type to work.  I'd like to set any line 
> that begins with "vms " to font-lock-constant face.  I thought 
> something like this should work:
>
>  ("^VMS.*$" . font-lock-constant-face)
>
> But the lines don't highlight at all.  If I do:
>
> ("^VMS" . font-lock-constant-face)
>
> the "VMS" is colored but the rest of the line isn't.  If I do this:
>
> ("^VMS...." . font-lock-constant-face)
>
> the "VMS" and four characters after are colored.  This suggests the 
> caret and the period are working as expected.  Is the engine matching 
> un-greedily?  Any help would be appriciated.
>
> Thanks,
> Dan

Well, you're doing the right thing by playing around with it.  You would 
do well to read up on regular expressions.  (But then so would I. B) )

I'm thinking you want something like "VMS .*$"

hth,
ken

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

* Re: keyword highlighting
       [not found] <mailman.2205.1094765546.1998.help-gnu-emacs@gnu.org>
@ 2004-09-10 15:13 ` FCC
  0 siblings, 0 replies; 3+ messages in thread
From: FCC @ 2004-09-10 15:13 UTC (permalink / raw)


Dan Boitnott articulated on 9/9/2004 11:26 PM:
> I'm adding keyword highlighting to a new major mode I'm writing.  I'm 
> having trouble getting one type to work.  I'd like to set any line that 
> begins with "vms " to font-lock-constant face.  I thought something 
> like this should work:
> 
>   ("^VMS.*$" . font-lock-constant-face)
> 
> But the lines don't highlight at all.  If I do:
> 
> ("^VMS" . font-lock-constant-face)
> 
> the "VMS" is colored but the rest of the line isn't.  If I do this:
> 
> ("^VMS...." . font-lock-constant-face)
> 
> the "VMS" and four characters after are colored.  This suggests the 
> caret and the period are working as expected.  Is the engine matching 
> un-greedily?  Any help would be appriciated.
> 
> Thanks,
> Dan
> 
> 
> 
I have just tested,
   ("\\(^VMS.*$\\)" 1 font-lock-warning-face prepend)
is working fine (all the line becomes red). may be it is the parantheses
that you lack in yours.

-- 
FCC.
===
There was never a genius without a tincture of madness.
-Aristotle.

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

end of thread, other threads:[~2004-09-10 15:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-09 21:26 keyword highlighting Dan Boitnott
2004-09-10 12:43 ` ken
     [not found] <mailman.2205.1094765546.1998.help-gnu-emacs@gnu.org>
2004-09-10 15:13 ` FCC

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.