emacs-devel
[Top][All Lists]
Advanced

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

Re: Problems with syntax-ppss: Was [... Apply `comment-depth' text prope


From: Stefan Monnier
Subject: Re: Problems with syntax-ppss: Was [... Apply `comment-depth' text properties when calling `back_comment'.]
Date: Thu, 10 Mar 2016 08:41:53 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

>> > There are several problems with syntax-ppss.  It is not a rigorously
>> Those problems are nitpicks about the current state of the implementation.
> No, these problems are to do with the philosophy of syntax-ppss.

Sorry, but "didn't reindent after adding with-syntax-table" is a very
far cry from a "philosophical" problem.

> To use it demands active maintenance of the cache from the program
> using it.

No, these are mere current implementation choices.

> (forward-comment -1) should just work, regardless of the buffer
> restriction, text properties, what have you.

By your own admission, your comment cache also has to make some
assumptions about what the user does (e.g. changing syntax-table, or
`category' properties, or modifying buffer-text within
inhibit-modification-hooks).

Those assumptions aren't exactly the same as the ones of syntax-ppss
simply because the two use different code, but none of the differences
are fundamental in any sense and it would be very easy to change your
code or syntax-ppss's to align one with the other.

> forward-comment should not erase syntax-table text properties.  This is,
> however, what syntax-ppss does.  Think about it, syntax-propertize calls
> syntax-propertize-extend-region-functions, which itself is likely to
> want to do (forward-comment -1).

Maybe it's "likely" in your book, but I haven't bumped into this is my
tests yet.

> Whoops!  forward-comment is a primitive - it shouldn't be dependent on
> the correct functioning of high level Lisp code.

forward-comment is not more primitive than syntax-ppss.

The fact that one is written in C and the other in Elisp is irrelevant
to their classification as "high-level vs primitive".

> back_comment.  My new text property cache just works, unobstrusively, in

Your "just works" has just the same kinds of strings attached as
syntax-ppss's.


        Stefan



reply via email to

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