unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Mattias Engdegård" <mattiase@acm.org>
Cc: 36496@debbugs.gnu.org
Subject: bug#36496: [PATCH] Describe the rx notation in the lisp manual
Date: Thu, 04 Jul 2019 19:28:01 +0300	[thread overview]
Message-ID: <838stdbw8e.fsf@gnu.org> (raw)
In-Reply-To: <0C783D67-9502-408B-B845-5599BD596361@acm.org> (message from Mattias Engdegård on Thu, 4 Jul 2019 14:13:26 +0200)

> From: Mattias Engdegård <mattiase@acm.org>
> Date: Thu, 4 Jul 2019 14:13:26 +0200
> 
> The rx notation is useful and complex enough to merit inclusion in the manual.
> 
> Right now, it's mainly described in the `rx' doc string, which is fairly well-written but quite long and a bit unstructured. Describing it in the manual permits a different pace and style of exposition, the inclusion of examples and related information, structured into separate sections with cross-references.
> 
> Proposed patch attached. It covers all rx features, functions, macros, including the pcase pattern, and a mention of the corresponding string regexp constructs.

This is a large section.  The ELisp reference is already a large book,
printed in two separate volumes.  So I think if we want to include
this section, it will have to be on a separate file that is
conditionally included @ifnottex.

Alternatively, we could make this a separate manual.

> The existing `rx' doc string can be left unchanged, or reduced to something more concise, perhaps without a description of the entire rx language but with a manual reference. Suggestions are welcome.

Yes, the doc string should be reduced to the summary of the
constructs.

> +@table @code
> +@item (let @var{ref} @var{rx-expr}@dots{})
> +Bind the name @var{ref} to a submatch that matches @var{rx-expr}@enddots{}.
   ^^^^^^^^^^^^^^^^^^^^^^^
"Bind the symbol @var{ref}", no?

> +@example
> +@group
> +(rx "/*"                          ; Initial /*
> +    (zero-or-more
> +     (or (not (any "*"))          ;  Either non-*,
> +         (seq "*"                 ;  or * followed by
> +              (not (any "/")))))  ;  non-/
> +    (one-or-more "*")             ; At least one star,
> +    "/")                          ; and the final /
> +@end group
> +@end example
> +
> +or, using shorter synonyms and written more compactly,

This last line needs @noindent before it.

> +@table @asis
> +@item @code{"some-string"}

Why @code{"..."} and not @samp{...}?  The latter will look better both
in print and in Info format.

> +Corresponding string regexp: @samp{AB@dots{}} (subexpressions in sequence).
                                ^^^^^^^^^^^^^^^^
I think this should use @samp{@var{a}@var{b}@dots{}} instead.  And
likewise for the other "corresponding string regexps".  The reason is
that neither A nor B stand for themselves, literally, they are
meta-variables.

> +Match the @var{rx}s once or not at all.@*

"Match @var{rx} or an empty string" sounds better to me.

> +Match the @var{rx}s zero or more times, non-greedily.@*

I would add here a cross-reference to where greedy matching is
described.

> +@item @code{(any @var{charset}@dots{})}

Please don't call this "charset", as that term is already taken by a
very different creature in Emacs.  I suggest "character set" instead.

> +Each @var{charset} is a character, a string representing the set of
> +its characters, a range or a character class.  A range is either a
> +hyphen-separated string like @code{"A-Z"}, or a cons of characters
> +like @code{(?A . ?Z)}.

Again, a cross-reference to where "character class" described would be
good here, as would a @cindex entry for "character class in rx".

> +@item @code{space}, @code{whitespace}, @code{white}
> +Match any character that has whitespace syntax.

Only ASCII or also non-ASCII?  This should be spelled out.

> +@xref{Syntax Class Table} for details.  Please note that
                            ^
Comma missing there.

> +@kbd{M-x describe-categories @key{RET}}.  @xref{Categories} for how
                                                              ^
Likewise.

Thanks.





  parent reply	other threads:[~2019-07-04 16:28 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-04 12:13 bug#36496: [PATCH] Describe the rx notation in the lisp manual Mattias Engdegård
2019-07-04 14:59 ` Drew Adams
2019-07-04 16:28 ` Eli Zaretskii [this message]
2019-07-05 14:13   ` Mattias Engdegård
2019-07-06  9:08     ` Eli Zaretskii
2019-07-06 11:33       ` Mattias Engdegård
2019-07-06 11:41         ` Eli Zaretskii
2019-07-06 18:56           ` Mattias Engdegård
2019-07-06 19:10             ` Eli Zaretskii
2019-07-06 19:45               ` Mattias Engdegård
2019-07-07  2:29                 ` Eli Zaretskii
2019-07-07 11:31                   ` Mattias Engdegård
2019-07-07 14:33                     ` Eli Zaretskii
2022-04-25 15:12                     ` Lars Ingebrigtsen
2019-07-06 19:12             ` Noam Postavsky
2019-07-06 11:59         ` Noam Postavsky
2019-07-06 23:56         ` Richard Stallman
2019-07-06  0:10   ` Richard Stallman
2019-07-06  6:47     ` Eli Zaretskii
2019-07-06 23:59       ` Richard Stallman
2019-07-07  0:36         ` Drew Adams
2019-07-07 23:51           ` Richard Stallman
2019-07-08  0:56             ` Drew Adams
2019-07-08 23:46               ` Richard Stallman
2019-07-09  0:19                 ` Drew Adams
2019-07-08 23:44             ` Richard Stallman

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=838stdbw8e.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=36496@debbugs.gnu.org \
    --cc=mattiase@acm.org \
    /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).