emacs-devel
[Top][All Lists]
Advanced

[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: Stefan Monnier
Subject: Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'.
Date: Tue, 08 Mar 2016 09:19:46 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

>     Apply `comment-depth' text properties when calling `back_comment'.

FWIW, I think if you want to speed up back_comment, a simpler approach
is to make it use syntax-ppss, which already implements a cache, and
will usually already have the cache filled for you.

IIRC this should be easy to do, conceptually something akin to

    diff --git a/src/syntax.c b/src/syntax.c
    index 9fc76a6..229e615 100644
    --- a/src/syntax.c
    +++ b/src/syntax.c
    @@ -903,6 +903,8 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, 
ptrdiff_t stop,
         to the one in question; this records where we
         last passed a comment starter.  */
           /* If we did not already find the defun start, find it now.  */
    +      if (use_syntax_ppss)
    +        return (nth 8 (syntax-ppss <somewhere>));
           if (defun_start == 0)
        {
          defun_start = find_defun_start (comment_end, comment_end_byte);

I did have a prototype working at some point, but I can't get my hands
on it right now.  IIRC the way it worked was basically by calling a new
syntax--back-comment function (in syntax.el) which did the (nth
8 (syntax-ppss)) dance.


        Stefan



reply via email to

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