GNU bug report logs - #32504
[PATCH] syntax-is-{comment|string}-p

Previous Next

Package: emacs;

Reported by: Alex Branham <alex.branham <at> gmail.com>

Date: Wed, 22 Aug 2018 20:20:02 UTC

Severity: wishlist

Tags: fixed, patch

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Noam Postavsky <npostavs <at> gmail.com>
To: Alex Branham <alex.branham <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 32504 <at> debbugs.gnu.org
Subject: bug#32504: [PATCH] syntax-is-{comment|string}-p
Date: Thu, 30 Aug 2018 21:21:54 -0400
Alex Branham <alex.branham <at> gmail.com> 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 ...))




This bug report was last modified 5 years and 314 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.