unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 20436@debbugs.gnu.org, Tom Tromey <tom@tromey.com>
Subject: bug#20436: 25.0.50; syntax-multiline not documented
Date: Tue, 13 Jul 2021 14:11:36 -0400	[thread overview]
Message-ID: <jwvlf6axf49.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87im1eqeos.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 13 Jul 2021 19:57:55 +0200")

Lars Ingebrigtsen [2021-07-13 19:57:55] wrote:
> Tom Tromey <tom@tromey.com> writes:
>> I noticed some code in syntax.el for the syntax-multiline property.
>> This doesn't seem to be documented anywhere, but I think it should be.
>
> Looking at this:
>
> (defun syntax-propertize-multiline (beg end)
>   "Let `syntax-propertize' pay attention to the syntax-multiline property."
>   (when (and (> beg (point-min))
> 	     (get-text-property (1- beg) 'syntax-multiline))
>     (setq beg (or (previous-single-property-change beg 'syntax-multiline)
> 		  (point-min))))
>   ;;
>   (when (get-text-property end 'syntax-multiline)
>     (setq end (or (text-property-any end (point-max)
> 				     'syntax-multiline nil)
> 		  (point-max))))
>   (cons beg end))
>
> And some of the usage sites...  I'm still not quite sure what the
> semantics here are.  :-)  I've added Stefan M to the CCs; perhaps he can
> explain and I'll write something up for the manual?

Its semantics is implemented by `syntax-propertize-multiline` (whose
docstring speaks volumes ;-), so the property is only effective after
you've added `syntax-propertize-multiline` to
`syntax-propertize-extend-region-functions`.

What it does is cause `syntax-propertize` to treat the marked text such
that it will always be propertized in a single call rather than two or
more separate calls.

The most common use for it is when the syntax to use for "FOO" depends
on some *later* text "BAR": by placing this property over the whole of
"FOO...BAR" you make sure that any change of "BAR" will cause the
syntax of "FOO" to be recomputed.


        Stefan






  reply	other threads:[~2021-07-13 18:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27  3:33 bug#20436: 25.0.50; syntax-multiline not documented Tom Tromey
2019-10-09  3:39 ` Lars Ingebrigtsen
2021-07-13 17:57 ` Lars Ingebrigtsen
2021-07-13 18:11   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-07-13 18:22     ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvlf6axf49.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=20436@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=tom@tromey.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).