unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: immerrr again <immerrr@gmail.com>
Cc: 17862@debbugs.gnu.org, Andreas Schwab <schwab@suse.de>
Subject: bug#17862: 24.3; regexp-opt docstring is incorrect
Date: Thu, 28 Jul 2016 21:10:11 -0400	[thread overview]
Message-ID: <87zip19rm4.fsf@users.sourceforge.net> (raw)
In-Reply-To: <CAERznn_DmedqmXVhBa4WpEYRY3pbxPTqFp+Z=zdSY3JPoC7S9g@mail.gmail.com> (immerrr again's message of "Sun, 7 Feb 2016 12:51:32 +0200")

immerrr again <immerrr@gmail.com> writes:

> +non-@code{nil}

Should be just non-nil, I believe.

> +    the resulting regexp is surrounded by @samp{\(} and @samp{\)}.
> +
> +Otherwise the resulting regexp is surrounded by @samp{\(?:} and
> +@samp{\)}.

This is not 100% accurate, here is a counterexample:

    (regexp-opt '("a" "b" "c")) ;=> "[abc]"

Not sure how detailed we want to be about this is in the docs though.

>  
>  This simplified definition of @code{regexp-opt} produces a
>  regular expression which is equivalent to the actual value
> -(but not as efficient):
> +(but typically more efficient):

"not as efficient" refers to the output of the simplified definition.

>  
>  @example
>  (defun regexp-opt (strings &optional paren)
> -  (let ((open-paren (if paren "\\(" ""))
> -        (close-paren (if paren "\\)" "")))
> +  (let ((open-paren (make-open-paren paren))
> +        (close-paren (make-close-paren paren)))

I'm not sure that adding these undefined make-{open,close}-paren
functions makes things any clearer.

>  The returned regexp is typically more efficient than the equivalent regexp:
>  
> - (let ((open (if PAREN \"\\\\(\" \"\")) (close (if PAREN \"\\\\)\" \"\")))
> + (let ((open (make-open-paren PAREN)) (close (make-close-paren PAREN)))

Same comment here.





  reply	other threads:[~2016-07-29  1:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-27  7:20 bug#17862: 24.3; regexp-opt docstring is incorrect immerrr again
2014-06-30 13:37 ` Stefan Monnier
2014-07-01  7:15   ` immerrr again
2014-07-01  6:52 ` Glenn Morris
2014-07-01  7:16   ` Andreas Schwab
2014-07-01 15:41     ` Glenn Morris
2014-07-01 16:22       ` Stefan Monnier
2016-02-07 10:51         ` immerrr again
2016-07-29  1:10           ` npostavs [this message]
2016-07-29  3:57             ` immerrr again
2016-07-30 13:28               ` npostavs
2016-08-21 12:47                 ` Noam Postavsky
2016-08-25 13:21                   ` immerrr again
2016-08-26  1:08                     ` npostavs
2016-08-29  8:45                       ` immerrr again
2016-09-02  3:06                         ` npostavs
2016-09-02  7:03                           ` Eli Zaretskii
2016-09-02 12:30                             ` immerrr again
2016-09-02 12:31                               ` immerrr again
2016-09-02 13:11                               ` Eli Zaretskii
2016-09-03 20:11                                 ` Noam Postavsky
2016-09-04  2:36                                   ` Eli Zaretskii
2016-09-04  3:59                                     ` npostavs

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=87zip19rm4.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=17862@debbugs.gnu.org \
    --cc=immerrr@gmail.com \
    --cc=schwab@suse.de \
    /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).