From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: regexp-opt-group Date: Mon, 20 Jan 2003 11:54:09 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200301201654.h0KGs9p10064@rum.cs.yale.edu> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1043082952 31563 80.91.224.249 (20 Jan 2003 17:15:52 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 20 Jan 2003 17:15:52 +0000 (UTC) Cc: Johan =?iso-8859-1?q?Bockg=E5rd?= Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18afWY-0008Cw-00 for ; Mon, 20 Jan 2003 18:15:50 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18afhW-0007Su-00 for ; Mon, 20 Jan 2003 18:27:10 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18afXQ-0004RP-02 for emacs-devel@quimby.gnus.org; Mon, 20 Jan 2003 12:16:44 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18afGE-0008At-00 for emacs-devel@gnu.org; Mon, 20 Jan 2003 11:58:58 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18afEn-0007Rl-00 for emacs-devel@gnu.org; Mon, 20 Jan 2003 11:57:30 -0500 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18afBb-0006Gq-00; Mon, 20 Jan 2003 11:54:11 -0500 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id h0KGs9p10064; Mon, 20 Jan 2003 11:54:09 -0500 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Richard Stallman Original-cc: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:10905 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:10905 > 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