From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: CVS directories in completion-ignored-extensions Date: 06 Jan 2004 09:08:25 +0900 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87r7yeq6py.fsf@tc-1-100.kawasaki.gol.ne.jp> References: <1892-Tue30Dec2003100155+0200-eliz@elta.co.il> <87n099j2fb.fsf@offby1.atm01.sea.blarg.net> <200312310108.hBV18Xj28227@raven.dms.auburn.edu> <20031231013407.GC19084@fencepost> <7137-Sat03Jan2004135259+0200-eliz@elta.co.il> <87u13bjmdd.fsf@tc-1-100.kawasaki.gol.ne.jp> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1073348112 1596 80.91.224.253 (6 Jan 2004 00:15:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 6 Jan 2004 00:15:12 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Jan 06 01:15:09 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AdesH-0001zu-00 for ; Tue, 06 Jan 2004 01:15:09 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AdesH-0008Vu-00 for ; Tue, 06 Jan 2004 01:15:09 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AdfnW-0008CD-8s for emacs-devel@quimby.gnus.org; Mon, 05 Jan 2004 20:14:18 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1Adfk9-000463-TZ for emacs-devel@gnu.org; Mon, 05 Jan 2004 20:10:50 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AdfjL-0002yd-Fa for emacs-devel@gnu.org; Mon, 05 Jan 2004 20:10:31 -0500 Original-Received: from [80.91.224.249] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AdfjK-0002wM-FG for emacs-devel@gnu.org; Mon, 05 Jan 2004 20:09:58 -0500 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1Adelo-0005OD-00 for ; Tue, 06 Jan 2004 01:08:28 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Adelm-0005O5-00 for ; Tue, 06 Jan 2004 01:08:26 +0100 Original-Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 1Adelm-0000Df-00 for ; Tue, 06 Jan 2004 01:08:26 +0100 Original-Lines: 47 Original-X-Complaints-To: usenet@sea.gmane.org System-Type: i686-pc-linux-gnu X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:19030 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:19030 Richard Stallman writes: > > I've always thought it would be nice, instead of having multiple > > variables each of which contain a different types of entry, to have > > something like `completion-ignored-names', where each element could > > be either: a string (which is matched using just `equal'), or a list > > like (regexp REGEXP), which the matcher would treat accordingly. > > That is a good idea. Ok, how about something like: (defun string-matcher-member (string matcher) "Return non-nil if STRING is matched by the `string matcher' MATCHER. MATCHER should be a list, where each element is either a string, which will be compared with STRING using `equal', or a cons of the form (regexp REGEXP), in which case REGEXP will be compared with STRING using `string-match'. The actual return value is the first element of MATCHER that matches." (let (test) (while matcher (setq test (pop matcher)) (if (cond ((stringp test) (equal string test)) ((eq (car-safe test) 'regexp) (if (consp (cdr test)) (string-match (car-safe (cdr-safe test)) string) (string-match (cdr-safe test) string)))) (setq matcher nil) (setq test nil))) test)) The name `string-matcher-member' is kind of ugly, but at least it seems fairly clear; maybe someone can think of a better name. The nice thing is that this is basically backward-compatible with existing lists of strings that are matched exactly, so perhaps some of them could be retro-fitted accordingly (e.g. `dabbrev-ignored-buffer-names'). [`special-display-buffer-names' is similar (it has a corresponding `special-display-regexps'), but because it itself gives special treatment to list members that are cons-cells, doesn't fit exactly into such a scheme (maybe it could be finessed, I don't know).] -Miles -- `Suppose Korea goes to the World Cup final against Japan and wins,' Moon said. `All the past could be forgiven.' [NYT]