bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17862: 24.3; regexp-opt docstring is incorrect


From: immerrr again
Subject: bug#17862: 24.3; regexp-opt docstring is incorrect
Date: Thu, 25 Aug 2016 16:21:41 +0300

On Sun, Aug 21, 2016 at 3:47 PM, Noam Postavsky
<npostavs@users.sourceforge.net> wrote:
> On Sat, Jul 30, 2016 at 9:28 AM,  <npostavs@users.sourceforge.net> wrote:
>>
>> <snip>
>>
>> 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)."
>>
>
> ping?

Sorry about that, other things took priority.

I liked your ideas, attached is a patch that borrows quite heavily
from them. What do you think?

Attachment: 0001-Fix-regexp-opt-documentation-bug-17862.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]