From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alex Schroeder Newsgroups: gmane.emacs.devel Subject: Re: Apropos commands and regexps Date: Sun, 12 May 2002 19:03:17 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: <87held70yy.fsf@emacswiki.org> References: <5xg00y41zj.fsf@kfs2.cua.dk> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: main.gmane.org 1021228564 3768 127.0.0.1 (12 May 2002 18:36:04 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 12 May 2002 18:36:04 +0000 (UTC) Cc: storm@cua.dk (Kim F. Storm), emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 176yCS-0000yf-00 for ; Sun, 12 May 2002 20:36:04 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 176yMe-00074e-00 for ; Sun, 12 May 2002 20:46:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 176yCW-00011I-00; Sun, 12 May 2002 14:36:08 -0400 Original-Received: from relay03.cablecom.net ([62.2.33.103]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 176yAD-0000k4-00 for ; Sun, 12 May 2002 14:33:45 -0400 Original-Received: from smtp.swissonline.ch (mail-4.swissonline.ch [62.2.32.85]) by relay03.cablecom.net (8.11.6/8.11.4/SOL/AWF/MXRELAY/06072001) with ESMTP id g4CIVp382589; Sun, 12 May 2002 20:31:52 +0200 (CEST) Original-Received: from confusibombus (dclient217-162-234-173.hispeed.ch [217.162.234.173]) by smtp.swissonline.ch (8.11.6/8.11.6/SMTPSOL/AWF/2002040101) with ESMTP id g4CGx0L11775; Sun, 12 May 2002 18:59:07 +0200 (MEST) Original-Received: from alex by confusibombus with local (Exim 3.12 #1 (Debian)) id 176wkf-00006g-00; Sun, 12 May 2002 19:03:17 +0200 Original-To: Kai.Grossjohann@cs.uni-dortmund.de (Kai =?iso-8859-1?q?Gro=DFjohann?=) In-Reply-To: (Kai.Grossjohann@CS.Uni-Dortmund.DE's message of "Sun, 12 May 2002 12:06:53 +0200") Original-Lines: 46 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i686-pc-linux-gnu) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:3863 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:3863 Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Gro=DFjohann) writes: > storm@cua.dk (Kim F. Storm) writes: > >> E.g. C-h a open file RET would find any matching >> >> open.*file and file.*open > > Way cool! I posted a similar thing in elisp some time back. Searching for it on Google returned this: Von:Alex Schroeder (asc@bsiag.com) Betrifft:Re: Emacs Boolean Help Newsgroups:gnu.emacs.gnus Datum:2000-08-17 10:07:22 PST (defun ed-apropos (keywords) "Search for KEYWORDS. This uses `apropos'. All the keywords must match. KEYWORDS can be a comma-separated list." (interactive "sKeywords: (comma-separated) ") (apropos (my-csv-string-to-regexp keywords))) (defun my-csv-string-to-regexp (str) "Translate comma separated values into regexp. A,B,C turns into \\(A.*B.*C\\|A.*C.*B\\|B.*A.*C\\|B.*C.*A\\|C.*A.*B\\|C.*B.= *A\\) (let* ((l (perms (split-string str ",\\s-*")))) (mapconcat (function (lambda (n) (mapconcat 'identity n ".*"))) l "\\|"))) ;; thanks to Christoph Conrad (require 'cl) (defun perms (l) (if (null l) (list '()) (mapcan #'(lambda( a ) (mapcan #'(lambda( p ) (list (cons a p))) (perms (remove* a l :count 1)))) l))) --=20 http://www.electronicintifada.net/diaries/index.html http://www.us-israel.org/jsource/US-Israel/hr2506c.html