From: Evans Winner <ego111@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Differing string delimiters for font-lock
Date: Thu, 14 Feb 2013 12:40:20 -0800 (PST) [thread overview]
Message-ID: <841d23f7-40d8-4996-896d-d78684fd3f90@googlegroups.com> (raw)
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.
next reply other threads:[~2013-02-14 20:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-14 20:40 Evans Winner [this message]
2013-02-15 0:46 ` Differing string delimiters for font-lock Evans Winner
2013-02-15 14:44 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=841d23f7-40d8-4996-896d-d78684fd3f90@googlegroups.com \
--to=ego111@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.