emacs-devel
[Top][All Lists]
Advanced

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

Re: Syntax tables for multiple modes [was: bug#22983: syntax-ppss return


From: Dmitry Gutov
Subject: Re: Syntax tables for multiple modes [was: bug#22983: syntax-ppss returns wrong result.]
Date: Sun, 20 Mar 2016 04:19:21 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0

On 03/20/2016 12:51 AM, Vitalie Spinu wrote:

You can simulate islands by marking inner spans as comments with comment classes
(11 and 12).

Ooh, that's a solid idea. Should be more generic that my "propertize <> as punctuation" approach.

I used those in polymode in the past, but not anymore. It's not
that useful. Most of the parsing that modes do is regex based.

I'd say it's still useful. Without the above, I've had indentation problems with sgml-mode.

A good mode would use syntax-ppss to check that point is not inside a string or comment. Maybe that's not often done in font-lock, but it's at least common in syntax-propertize and indentation functions.

Example: sgml-lexical-context. It performs a search at first, but in the end uses parse-partial-sexp, and returns a value based on that status.

So if a mode
author decides to regexpf for a wiki link on a full buffer after widening it,
islands won't help.

Where does widening happens in this case? First, we have font-lock-dont-widen.

For indentation, we've introduced prog-indentation-context recently. And indentation functions in programming modes are supposed to call prog-widen instead of widen now.

syntax-propertize-function's aren't supposed to call widen at all, I think.

IMO the most useful direction for multi-modes is to add a hard narrowing that
Stephen mentioned in the other thread. `syntax-ppss-dont-widen` goes in that
direction, but it doesn't address the issue of distinguishing between user
narrowing and "hard narrowing" in multi modes.

syntax-ppss-dont-widen and prog-indentation-context will be the indicators of the "hard narrowing", I guess.



reply via email to

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