From: storm@cua.dk (Kim F. Storm)
Cc: Kai.Grossjohann@cs.uni-dortmund.de (Kai Großjohann), emacs-devel@gnu.org
Subject: Re: Apropos commands and regexps
Date: 13 May 2002 21:26:18 +0200 [thread overview]
Message-ID: <5x3cwv97dx.fsf@kfs2.cua.dk> (raw)
In-Reply-To: <87held70yy.fsf@emacswiki.org>
Alex Schroeder <alex@emacswiki.org> writes:
> Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) 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:
Interesting...
However, my proposal is to make keyword matching the default
(alternative) behaviour for all apropos commands.
Your "all permutations" seems useful -- but I wonder whether it is
overkill... If a user is searching for some command which does
something "useful", it is already quite hard to guess the terms emacs
may be using to accomplish a given task (e.g. some novice users may search
for "change file" when they really should look for "switch buffer").
So my idea of just searching for any entry matching at least two keywords
will find all the entries found by searching for all combinations - and
it may find some entries the user didn't think about...
>
> 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 <cc@cli.de>
> (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)))
>
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
next prev parent reply other threads:[~2002-05-13 19:26 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-12 0:57 Apropos commands and regexps Kim F. Storm
2002-05-12 5:28 ` Eli Zaretskii
2002-05-12 5:38 ` Eli Zaretskii
2002-05-13 1:40 ` Miles Bader
2002-05-13 19:18 ` Kim F. Storm
2002-05-14 5:55 ` Miles Bader
2002-05-13 19:11 ` Kim F. Storm
2002-05-14 5:38 ` Miles Bader
2002-05-15 7:00 ` Richard Stallman
2002-05-15 11:23 ` Miles Bader
2002-05-15 21:59 ` Kim F. Storm
2002-05-16 1:26 ` Miles Bader
2002-05-16 22:26 ` Kim F. Storm
2002-05-16 21:38 ` Stefan Monnier
2002-05-17 11:59 ` Kai Großjohann
2002-05-18 18:48 ` Richard Stallman
2002-05-18 22:24 ` Stefan Monnier
2002-05-19 12:02 ` Kai Großjohann
2002-05-19 14:50 ` Eli Zaretskii
2002-05-19 15:23 ` Kai Großjohann
2002-05-19 19:40 ` Richard Stallman
2002-05-19 23:33 ` Kim F. Storm
2002-05-20 9:50 ` Alex Schroeder
2002-05-16 21:58 ` Miles Bader
2002-05-17 12:01 ` Kai Großjohann
2002-05-17 21:56 ` Kim F. Storm
2002-05-18 6:31 ` Eli Zaretskii
2002-05-18 22:47 ` Stefan Monnier
2002-05-17 6:15 ` Eli Zaretskii
2002-05-17 11:58 ` Kai Großjohann
2002-05-16 4:54 ` Eli Zaretskii
2002-05-16 22:10 ` Kim F. Storm
2002-05-16 21:20 ` Miles Bader
2002-05-17 6:13 ` Eli Zaretskii
2002-05-18 18:49 ` Richard Stallman
2002-05-19 4:51 ` Eli Zaretskii
2002-05-19 19:40 ` Richard Stallman
2002-05-19 23:29 ` Kim F. Storm
2002-05-20 3:31 ` Eli Zaretskii
2002-05-16 20:24 ` Richard Stallman
2002-05-15 21:55 ` Kim F. Storm
2002-05-16 4:52 ` Eli Zaretskii
[not found] ` <5xbsbf4thx.fsf@kfs2.cua.dk>
2002-05-17 6:22 ` Eli Zaretskii
2002-05-12 10:06 ` Kai Großjohann
2002-05-12 17:03 ` Alex Schroeder
2002-05-13 19:26 ` Kim F. Storm [this message]
2002-05-14 5:26 ` Miles Bader
2002-05-16 11:04 ` Kai Großjohann
2002-05-16 12:30 ` Eli Zaretskii
2002-05-16 13:05 ` D. Goel
2002-05-16 22:37 ` Alex Schroeder
2002-05-16 22:44 ` Kim F. Storm
2002-05-17 19:28 ` Richard Stallman
2002-05-18 6:26 ` Eli Zaretskii
2002-05-19 5:30 ` Richard Stallman
2002-05-23 21:41 ` Kim F. Storm
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5x3cwv97dx.fsf@kfs2.cua.dk \
--to=storm@cua.dk \
--cc=Kai.Grossjohann@cs.uni-dortmund.de \
--cc=emacs-devel@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.