bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#32504: [PATCH] syntax-is-{comment|string}-p


From: Noam Postavsky
Subject: bug#32504: [PATCH] syntax-is-{comment|string}-p
Date: Thu, 30 Aug 2018 21:21:54 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Alex Branham <address@hidden> writes:

>>     (cl-defstruct (syntax-state (:constructor nil)
>>                                 (:type list))
>>       depth list-start sexp-end
>>       string-start comment quoted
         ^^^^^^^^^^^^
That should be string-terminator

>>       min-depth comment-style comment-or-string-start
>>       open-parens syntax-sequence)
>
> I'm not a big fan of the docstrings generated by this, is there a way to
> change them to be more helpful?

Hmm, doesn't look like it.  Well, that's just a convenient way of
defining them all quickly for discussion, it wouldn't be that much
harder to write out defuns I guess.

> But it would be a lot better (in my eyes, anyway) if it looked something
> like this, had the -p suffix, and made CL-X default to point:

> Return non-nil if the syntax of CL-X is a comment.

I don't think it should be a -p predicate, because there is meaningful
distinction between non-nil values:

     4. nil if outside a comment, t if inside a non-nestable comment,
        else an integer (the current comment nesting).

> CL-X defaults to point.

And, my intention is to operate on the return value of syntax-ppss, not
give a point to call it with.  So it could be used as:

    (syntax-state-comment (syntax-ppss))

or

    (let ((ppss (syntax-ppss)))
      (and (syntax-state-comment ppss)
           (syntax-state-comment-or-string-start ppss)))

or

    (syntax-state-comment (parse-partial-sexp ...))





reply via email to

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