* Generic mode -- keywords
@ 2011-08-29 16:15 fork
2011-08-29 16:34 ` Drew Adams
0 siblings, 1 reply; 3+ messages in thread
From: fork @ 2011-08-29 16:15 UTC (permalink / raw)
To: help-gnu-emacs
I have written a generic mode for sas editing (ESS sucks and is WAY to big and
complex, sorry if I offend...).
Below [1] is a contrived example of that code, which basically highlights
comments, the keyword "and", and the funky SAS commenting style of "* blah;"
(asterix followed by semicolon with commented stuff in between):
When editing, if a defined keyword like "and" is contained in a "*;" type
comment, the mode doesn't highlight the *; comment, but as long as there is no
keyword, it works fine.
Is there a way to force the *; comment pattern to override the keyword behavior?
[1]:
(define-generic-mode 'simple-sas-mode
'(("/*" . "*/"))delimiters
'(
"and"
)
'(
("\\(\\*[^;\\*/]*;\\)" 1 'font-lock-comment-face)
)
; ... other stuff
)
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: Generic mode -- keywords
2011-08-29 16:15 Generic mode -- keywords fork
@ 2011-08-29 16:34 ` Drew Adams
2011-08-29 17:17 ` fork
0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2011-08-29 16:34 UTC (permalink / raw)
To: 'fork', help-gnu-emacs
> Is there a way to force the *; comment pattern to override
> the keyword behavior?
I'm no expert here, but see (elisp) Search-based Fontification, and check `keep'
and `t' to deal with overriding.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Generic mode -- keywords
2011-08-29 16:34 ` Drew Adams
@ 2011-08-29 17:17 ` fork
0 siblings, 0 replies; 3+ messages in thread
From: fork @ 2011-08-29 17:17 UTC (permalink / raw)
To: help-gnu-emacs
Drew Adams <drew.adams <at> oracle.com> writes:
> I'm no expert here, but see (elisp) Search-based Fontification, > and check
`keep' and `t' to deal with overriding.
Well, you pass for an expert in my book. Here is a new line for comment face:
("\\(\\*[^;\\*/]*;\\)" 0 'font-lock-comment-face t)
I think with my new found knowledge, I might also be able to handle places with
string expansion. E.G.: "blah &foo. blah" Should have read for the constant
string but (say) blue for the stuff inside "&." My mode currently has red for
the whole string.
Tx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-29 17:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-29 16:15 Generic mode -- keywords fork
2011-08-29 16:34 ` Drew Adams
2011-08-29 17:17 ` fork
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).