emacs-devel
[Top][All Lists]
Advanced

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

Re: regexp-opt-group


From: Stefan Monnier
Subject: Re: regexp-opt-group
Date: Mon, 20 Jan 2003 11:54:09 -0500

> With this change, does everything work right?
> It appears to be the right fix for this bug,
> but I didn't have time to study the whole file carefully.
> 
> *** regexp-opt.el.~1.21.~     Thu Jun 20 10:43:11 2002
> --- regexp-opt.el     Sun Jan 19 17:18:58 2003
> ***************
> *** 223,229 ****
>             ;; particular letter and those that do not, and recurse on them.
>             (let* ((char (char-to-string (string-to-char (car strings))))
>                    (half1 (all-completions char strings))
> !                  (half2 (nthcdr (length half1) strings)))
>               (concat open-group
>                       (regexp-opt-group half1)
>                       "\\|" (regexp-opt-group half2)
> --- 223,231 ----
>             ;; particular letter and those that do not, and recurse on them.
>             (let* ((char (char-to-string (string-to-char (car strings))))
>                    (half1 (all-completions char strings))
> !                  (half2 strings))
> !             (dolist (elt half1)
> !               (setq half2 (delq elt half2)))
>               (concat open-group
>                       (regexp-opt-group half1)
>                       "\\|" (regexp-opt-group half2)

The `strings' list is expected to always be properly sorted.
I believe that if the list is indeed sorted, then
(nthcdr (length half1) strings) should DTRT (and faster than your loop).
OTOH, if the list is not properly sorted, then it's probably a bug
somewhere else.
Note: I haven't seen the original message from Johan.


        Stefan





reply via email to

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