unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
Cc: "Johan Bockgård" <bojohan@helm.dd.chalmers.se>
Subject: Re: regexp-opt-group
Date: Mon, 20 Jan 2003 11:54:09 -0500	[thread overview]
Message-ID: <200301201654.h0KGs9p10064@rum.cs.yale.edu> (raw)
In-Reply-To: E18aQ93-0006UE-00@fencepost.gnu.org

> 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	other threads:[~2003-01-20 16:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <yoijof6e2j5v.fsf@helm.dd.chalmers.se>
2003-01-20  0:50 ` regexp-opt-group Richard Stallman
2003-01-20 16:54   ` Stefan Monnier [this message]
2003-01-20 17:37     ` regexp-opt-group Johan Bockgård
2003-01-20 17:42       ` regexp-opt-group Stefan Monnier
2003-01-22 10:00         ` regexp-opt-group Richard Stallman

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=200301201654.h0KGs9p10064@rum.cs.yale.edu \
    --to=monnier+gnu/emacs@rum.cs.yale.edu \
    --cc=bojohan@helm.dd.chalmers.se \
    /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).