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


On Thu 30 Aug 2018 at 20:21, Noam Postavsky <npostavs@gmail.com> wrote:

>> 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.

Fair enough.

> 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).

That makes sense, but the -p predicate seems more discoverable to me. We
can always note in the docstring that the actual return value is usable.
I don't have a super strong opinion though.

>> 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 ...))

Right, but whenever I want to call on these functions, 90% of the time
the question I'm trying to answer is "Is point in a comment/string?" And
the 3rd party ***-is-comment/string-p functions I've looked at usually
(always?) look at positions.

Thanks,
Alex





  reply	other threads:[~2018-08-31  2:50 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
2018-08-31  2:50               ` Alex Branham [this message]
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=87bm9js0zm.fsf@gmail.com \
    --to=alex.branham@gmail.com \
    --cc=32504@debbugs.gnu.org \
    --cc=npostavs@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).