From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: syntax-propertize-function for multiline strings
Date: Mon, 06 Jan 2014 19:58:25 -0500 [thread overview]
Message-ID: <jwvzjn8obyf.fsf-monnier+gmane.emacs.help@gnu.org> (raw)
In-Reply-To: CAAWtsQzq=5L3yvHM4dwdvhHTjhADkfdjCMNK56iYpSGtoF9sEA@mail.gmail.com
> (defconst test-syntax-propertize-function
> (syntax-propertize-rules
> ("@\\(\"\\)\\(:?\"\"\\|[^\"]\\)*\\(\"\\)"
> (1 "\"") (2 "\""))))
Usually, the best way to deal with it is along the following lines
(guaranteed 100% untested):
(defun test-syntax-propertize-function (start end)
(goto-char start)
(test-syntax-verbatim-string end)
(funcall (syntax-propertize-rules
("\\(@\\)\"" (1 (prog1 "|" (test-syntax-verbatim-string end)))))
start end))
(defun test-syntax-verbatim-string (end)
(when (eq t (nth 3 (syntax-ppss)))
(while
(when (re-search-forward "\"\"?" end 'move)
(if (> (- (match-end 0) (match-beginning 0)) 1)
t ;; Skip this "" and keep looking further.
(put-text-property (match-beginning 0) (match-end 0)
'syntax-table (string-to-syntax "|"))
nil)))))
-- Stefan
prev parent reply other threads:[~2014-01-07 0:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-06 21:48 syntax-propertize-function for multiline strings Robin Neatherway
2014-01-07 0:58 ` Stefan Monnier [this message]
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=jwvzjn8obyf.fsf-monnier+gmane.emacs.help@gnu.org \
--to=monnier@iro.umontreal.ca \
--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.