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: Sat, 30 Jul 2016 09:28:31 -0400 [thread overview]
Message-ID: <87lh0j9rwg.fsf@users.sourceforge.net> (raw)
In-Reply-To: <CAFKGYcMiL0D08KZ0O=-zyp9ze9-YkWE4OU_ELk95+mfiw4oicg@mail.gmail.com> (immerrr again's message of "Fri, 29 Jul 2016 06:57:37 +0300")
immerrr again <immerrr@gmail.com> writes:
>>> +non-@code{nil}
>>
>> Should be just non-nil, I believe.
>>
>
> I was following the precedent set by other documentation in
> searching.texi.
Oh, hmm, you're right, most uses are non-@code{nil}. Somehow I had the
impression that nil should be undecorated (maybe I mixed up with
docstring quoting rules).
>
> I agree that adding "impenetrable definitions" might be unclear, but I'd argue
> that it's still an improvement because the equivalence statement is
> plain false now:
>
> - "words" and "symbol" keywords add special backslash characters
> around the result
>
> - if PAREN is nil, the result is still grouped (unless the strings can be
> represented as a character set, but that's not handled in the
> simplified version)
>
> I doubt we can put all the logic behind PAREN into the simplified version.
Hah, sounds like a challenge :) How about
(defun simplified-regexp-opt (strings &optional paren)
(let ((parens (cond ((eq paren 'words) '("\\<\\(" . "\\)\\>"))
((eq paren 'symbols) '("\\_<\\(" . "\\)\\_>"))
((null paren) '("\\(?:" . "\\)"))
(t '("\\(" . "\\)")))))
(concat (car paren)
(mapconcat 'regexp-quote strings "\\|")
(cdr paren))))
> +@code{nil}
> + if all @var{strings} are single-character, the resulting regexp is
> + not surrounded, otherwise it is surrounded by @samp{\(?:} and
> + @samp{\)}.
Zero character strings also:
(regexp-opt '("a" "")) ;=> "a?"
How about saying "the regexp may be surrounded with \?(: ) to ensure that
it constitutes a single expression (such that appending a postfix
operator like '+' will apply to the whole expression)."
next prev parent reply other threads:[~2016-07-30 13:28 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
2016-07-29 3:57 ` immerrr again
2016-07-30 13:28 ` npostavs [this message]
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=87lh0j9rwg.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).