help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Differing string delimiters for font-lock


From: Evans Winner
Subject: Differing string delimiters for font-lock
Date: Thu, 14 Feb 2013 12:40:20 -0800 (PST)
User-agent: G2/1.0

Is there a reasonable way to use two differing delimiters
for strings for font-lock purposes?

Concretely, what I am doing is this: I am trying to define a
`text-mode'-like mode with define-generic-mode that will
fontify strings set off with quotes; but I am also using
typopunct-mode to get "smart" quotes, “like this.”

So in the buffer, strings are not marked off by a single
character, but a pair of matching characters, like
parentheses.

I have tried something along the lines of --

   (modify-syntax-entry ?“ "\"")
   (modify-syntax-entry ?” "\"")

and then later

  '("\\s\"\\|\\s|" . font-lock-string-face)

This almost works, but it doesn’t end fontification at the
close-quote, and instead continues until it finds the next
open quote, where it then ends fontification.

Perhaps the answer is to define them as open and close
delimiters, but then I don’t know how to create a regexp to
fontify everything within those delimiters.  So... that’s as
far as I’ve gotten.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]