* Adjusting string font-locking to not span multiple lines
@ 2008-05-16 10:35 Nordlöw
2008-05-16 11:09 ` David Hansen
[not found] ` <mailman.11679.1210937018.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 4+ messages in thread
From: Nordlöw @ 2008-05-16 10:35 UTC (permalink / raw)
To: help-gnu-emacs
Hey there!
I would like to override the behaviour for string highlighting in
lines such as the following.
0 string \xad6" AMGC archive data
such that the the whole pattern
\xad6"
is highlighted in the font-lock-constant-face
in order to prevent font-lock from highlighting the rest of the buffer
in font-lock-string-face.
How do I accomplish this?
Thanks in advance,
Nordlöw
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Adjusting string font-locking to not span multiple lines
2008-05-16 10:35 Adjusting string font-locking to not span multiple lines Nordlöw
@ 2008-05-16 11:09 ` David Hansen
[not found] ` <mailman.11679.1210937018.18990.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 4+ messages in thread
From: David Hansen @ 2008-05-16 11:09 UTC (permalink / raw)
To: help-gnu-emacs
On Fri, 16 May 2008 03:35:48 -0700 (PDT) Nordlöw wrote:
> I would like to override the behaviour for string highlighting in
> lines such as the following.
>
> 0 string \xad6" AMGC archive data
>
> such that the the whole pattern
> \xad6"
> is highlighted in the font-lock-constant-face
>
> in order to prevent font-lock from highlighting the rest of the buffer
> in font-lock-string-face.
>
> How do I accomplish this?
If double quotes aren't used as string delimiters at all, just change
the syntax of the double quote character. Otherwise you have to use
font-lock-syntactic-keywords to overwrite the syntax-table.
David
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Adjusting string font-locking to not span multiple lines
[not found] ` <mailman.11679.1210937018.18990.help-gnu-emacs@gnu.org>
@ 2008-05-16 13:39 ` Nordlöw
2008-05-16 15:03 ` David Hansen
0 siblings, 1 reply; 4+ messages in thread
From: Nordlöw @ 2008-05-16 13:39 UTC (permalink / raw)
To: help-gnu-emacs
On 16 Maj, 13:09, David Hansen <david.han...@gmx.net> wrote:
> On Fri, 16 May 2008 03:35:48 -0700 (PDT) Nordlöw wrote:
>
> > I would like to override the behaviour for string highlighting in
> > lines such as the following.
>
> > 0 string \xad6" AMGC archive data
>
> > such that the the whole pattern
> > \xad6"
> > is highlighted in the font-lock-constant-face
>
> > in order to prevent font-lock from highlighting the rest of the buffer
> > in font-lock-string-face.
>
> > How do I accomplish this?
>
> If double quotes aren't used as string delimiters at all, just change
> the syntax of the double quote character. Otherwise you have to use
> font-lock-syntactic-keywords to overwrite the syntax-table.
>
> David
How do I "just change the syntax of the double quote character"?
Do you mean like:
(setq font-lock-defaults `(filemagic-font-lock-keywords nil))
Thanks in advance,
Nordlöw
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Adjusting string font-locking to not span multiple lines
2008-05-16 13:39 ` Nordlöw
@ 2008-05-16 15:03 ` David Hansen
0 siblings, 0 replies; 4+ messages in thread
From: David Hansen @ 2008-05-16 15:03 UTC (permalink / raw)
To: help-gnu-emacs
On Fri, 16 May 2008 06:39:22 -0700 (PDT) Nordlöw wrote:
> On 16 Maj, 13:09, David Hansen <david.han...@gmx.net> wrote:
>> On Fri, 16 May 2008 03:35:48 -0700 (PDT) Nordlöw wrote:
>>
>> > I would like to override the behaviour for string highlighting in
>> > lines such as the following.
>>
>> > 0 string \xad6" AMGC archive data
>>
>> > such that the the whole pattern
>> > \xad6"
>> > is highlighted in the font-lock-constant-face
>>
>> If double quotes aren't used as string delimiters at all, just change
>> the syntax of the double quote character. Otherwise you have to use
>> font-lock-syntactic-keywords to overwrite the syntax-table.
>
> How do I "just change the syntax of the double quote character"?
This is a very good tutorial on writing an emacs major mode. Check the
paragraph "Syntax table modifications":
http://two-wugs.net/emacs/mode-tutorial.html
Note that modifying the syntax-table also affects other parts of emacs
behavior (e.g. forward/backward-sexp). But from above example this is
probably what you want.
David
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-05-16 15:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-16 10:35 Adjusting string font-locking to not span multiple lines Nordlöw
2008-05-16 11:09 ` David Hansen
[not found] ` <mailman.11679.1210937018.18990.help-gnu-emacs@gnu.org>
2008-05-16 13:39 ` Nordlöw
2008-05-16 15:03 ` David Hansen
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.