unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Alex Branham <alex.branham@gmail.com>
Cc: 32504@debbugs.gnu.org
Subject: bug#32504: [PATCH] syntax-is-{comment|string}-p
Date: Thu, 30 Aug 2018 21:21:54 -0400	[thread overview]
Message-ID: <87bm9js53h.fsf@gmail.com> (raw)
In-Reply-To: <87efefgbpj.fsf@gmail.com> (Alex Branham's message of "Thu, 30 Aug 2018 09:39:52 -0500")

Alex Branham <alex.branham@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 ...))





  reply	other threads:[~2018-08-31  1:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22 20:05 bug#32504: [PATCH] syntax-is-{comment|string}-p Alex Branham
2018-08-23  3:12 ` Noam Postavsky
2018-08-23 13:01   ` Alex Branham
2018-08-23 13:58     ` Eli Zaretskii
2018-08-24 16:11       ` Alex Branham
2018-08-24 19:28         ` Eli Zaretskii
2018-08-24 19:49           ` Alex Branham
2018-08-26  6:33             ` Andreas Röhler
2018-08-25  2:26         ` Noam Postavsky
2018-08-30 14:39           ` Alex Branham
2018-08-31  1:21             ` Noam Postavsky [this message]
2018-08-31  2:50               ` Alex Branham
2019-07-09  0:05                 ` Noam Postavsky
2019-07-11  5:11                   ` Leo Liu
2018-08-23 23:18     ` Phil Sainty
2019-06-23 22:05   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bm9js53h.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=32504@debbugs.gnu.org \
    --cc=alex.branham@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).