From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: Why do apropos commands match only pairs of words in a word-list pattern? Date: Sat, 9 May 2015 12:16:57 -0700 (PDT) Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1431199047 18990 80.91.229.3 (9 May 2015 19:17:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 May 2015 19:17:27 +0000 (UTC) To: "Emacs-Devel (emacs-devel@gnu.org)" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 09 21:17:15 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YrAFO-0006n0-81 for ged-emacs-devel@m.gmane.org; Sat, 09 May 2015 21:17:14 +0200 Original-Received: from localhost ([::1]:60244 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrAFN-0008MT-13 for ged-emacs-devel@m.gmane.org; Sat, 09 May 2015 15:17:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrAFB-0008MN-PI for emacs-devel@gnu.org; Sat, 09 May 2015 15:17:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YrAF8-00051d-JD for emacs-devel@gnu.org; Sat, 09 May 2015 15:17:01 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:37896) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrAF8-00050w-D0 for emacs-devel@gnu.org; Sat, 09 May 2015 15:16:58 -0400 Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t49JGuh9031400 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 9 May 2015 19:16:57 GMT Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t49JGuQQ015982 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sat, 9 May 2015 19:16:56 GMT Original-Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t49JGtWo004167 for ; Sat, 9 May 2015 19:16:55 GMT X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:186373 Archived-At: If you type a list of words to match, instead of typing a regexp, to a command such as `apropos', each word is not matched against the candidates and then the intersection of those match sets retained. Instead of matching each word in the list you provide it, apropos commands match each pair of words from the list. For example, if you type `foo bar toto' then all matches of `foo' & `bar' (in either order) are retained, plus all matches of `bar' & `toto', plus all matches of `foo' & `toto'. So for instance, a candidate `some-bar-foo-thing' is retained, even though it does not also match `toto' - it is enough that it matches both `foo' and `bar'. Why is this the design? Wouldn't users more typically want *each* of the words they type to be matched? Is this perhaps only because the existing code before introducing word-list patterns provided for using a regexp, and in order to bolt word-list matching onto that existing code it was thought to be easier to just come up with a single regexp to match, instead of handling the word-list case as an intersection of separate matches? IOW, was this just an implementation decision, or is there some more important reason for it, from a user point of view? The behavior is documented, in (emacs)`Apropos', as follows: When you specify more than one word in the apropos pattern, a name must contain at least two of the words in order to match. No reason given there as to why this would be behavior you might want or expect. And beyond that brief description, there is only this comment in the apropos.el code: ;; We don't actually make a regexp matching all permutations. ;; Instead, for e.g. "a b c", we make a regexp matching ;; any combination of two or more words like this: ;; (a|b|c).*(a|b|c) which may give some false matches, ;; but as long as it also gives the right ones, that's ok. That tells what happens, but not why this choice was made. And the last line almost sounds like an apology, as if this is not ideal but it is generally OK, since although extra junk is included at least we don't missing any sought matches. IOW, it sounds like, even though you really want only matches of all three: `foo' & `bar' & `toto', we think it's OK if you get additional, false positives such as `some-bar-foo-thing', as long as you also get all true positives (such as `a-bar-toto-foo-thing'). Is this the right behavior? If so, why - what am I missing?