[Top][All Lists]

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

Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text

From: Dmitry Gutov
Subject: Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'.
Date: Sat, 12 Mar 2016 23:59:21 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0

On 03/12/2016 11:29 PM, Clément Pit--Claudel wrote:

Does this break on

  /<point>* test */

in C mode? (<point> indicate the position of the point)

If by break you mean does nothing, then yes. In what practical situations is this a problem?

There might be ways to alleviate it (make syntax-ppss scan forward a little, e.g. till the end of the line), but a naive solution might mess up how syntax-propertize works:

a) It wraps the calls to syntax-propertize-function in inhibit-modification-hooks.

b) That function is allowed to call syntax-ppss as well, and then modify the syntax-table property of any position after the call. If syntax-ppss is allowed to rely on the syntax class of '*', it might return (and cache) a value that will turn out to be false in the future.

*If* the issue is an actual problem, the best way to handle it might be in the caller of syntax-ppss. If the caller is not a part of syntax-propertize-function, or at least it doesn't inhibit modification hooks, it can try evaluating (nth 8 (syntax-ppss pos)) in several positions - from (point) to (+ (point) n -1), where n is the maximum length of a comment starter in the current language. When one of the calls returns a non-nil position (but one that's before point) => jump there.

reply via email to

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