From unknown Sat Aug 16 22:46:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13946: 24.3; [PATCH] fix of apropos with words Resent-From: Shigeru Fukaya Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Mar 2013 15:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13946 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 13946@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13631881885031 (code B ref -1); Wed, 13 Mar 2013 15:24:02 +0000 Received: (at submit) by debbugs.gnu.org; 13 Mar 2013 15:23:08 +0000 Received: from localhost ([127.0.0.1]:51434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFnWE-0001J4-QM for submit@debbugs.gnu.org; Wed, 13 Mar 2013 11:23:07 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58832) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFnWB-0001Ia-NU for submit@debbugs.gnu.org; Wed, 13 Mar 2013 11:23:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFnUu-000275-3E for submit@debbugs.gnu.org; Wed, 13 Mar 2013 11:21:52 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:53251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFnUu-000270-0V for submit@debbugs.gnu.org; Wed, 13 Mar 2013 11:21:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFnUp-0002gP-7y for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2013 11:21:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFnUj-00024t-7R for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2013 11:21:39 -0400 Received: from mail-da0-x230.google.com ([2607:f8b0:400e:c00::230]:59041) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFnUj-00024l-16 for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2013 11:21:33 -0400 Received: by mail-da0-f48.google.com with SMTP id w4so456842dam.21 for ; Wed, 13 Mar 2013 08:21:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:mime-version:content-type :content-transfer-encoding:x-mailer:message-id; bh=1DvhxBmmHvaxI0dLbsZg/Qmrz/HOKJnPOIw9shqcmPE=; b=q+Slp8WwF7ZR5z2GqZZsGdkyDTynwq1EzjSAGPItqFwmTFNpzDIVIG1H5Hnu5U8YGu 0pjEZ4CNiiVsv2UGLHj9oijTpBCW+geyNn4mNwoUSQXwh1vJsJ/tjtWKetb7gMh72HAS CfZxH9Tabnh2SzOccSysMRwZogtMTAiBoj9D5P+WzLPZib3VLPbx/sz4C/mtSZCY04BM mpmZQ1Oa0QWPbiwQnq30NrLCfm1o3wBC1WrhrsnpyZSv36X2DIhObJMkYOJX4HUQ4PlQ dPhpFA/LWUheCLF9JOjlowWiH3+L0bd6Yky8dN3UELm3PYup+BiU8CB5x67Y4fHsQB92 NrwA== X-Received: by 10.68.212.104 with SMTP id nj8mr40937558pbc.197.1363188091886; Wed, 13 Mar 2013 08:21:31 -0700 (PDT) Received: from gmail.com (115x125x38x6.ap115.ftth.ucom.ne.jp. [115.125.38.6]) by mx.google.com with ESMTPS id iu10sm30047619pbc.13.2013.03.13.08.21.28 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 13 Mar 2013 08:21:30 -0700 (PDT) From: Shigeru Fukaya Date: Thu, 14 Mar 2013 00:21:29 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: HidemaruMail 6.00 (WinNT,601) Message-Id: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -3.4 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) Hello, `apropos' family with plural words returns unexpected symbols and are annoying. It is because `apropos-words-to-regexp' doesn't work as documented/expected. The following is revised `apropos-words-to-regexp'. (defun apropos-words-to-regexp (words wild) "Make regexp matching any two of the words in WORDS." (if (null (cdr words)) (car words) ;; assure all words are independent objects for delq (setq words (mapcar 'copy-sequence words)) (mapconcat (lambda (w) (concat "\\(?:" w "\\)" ;; parens for synonyms wild "\\(?:" (mapconcat 'identity (delete-dups (delq w (copy-sequence words))) "\\|") "\\)")) (delete-dups (copy-sequence words)) "\\|"))) results: (apropos-words-to-regexp '("A" "B") ".*?") "\\(?:A\\).*?\\(?:B\\)\\|\\(?:B\\).*?\\(?:A\\)" (apropos-words-to-regexp '("A" "B" "C") ".*?") "\\(?:A\\).*?\\(?:B\\|C\\)\\|\\(?:B\\).*?\\(?:A\\|C\\)\\|\\(?:C\\).*?\\(?:A\\|B\\)" (apropos-words-to-regexp '("A" "B" "B") ".*?") "\\(?:A\\).*?\\(?:B\\)\\|\\(?:B\\).*?\\(?:A\\|B\\)" (apropos-words-to-regexp '("A" "A" "B" "C" "C") ".*?") "\\(?:A\\).*?\\(?:A\\|B\\|C\\)\\|\\(?:B\\).*?\\(?:A\\|C\\)\\|\\(?:C\\).*?\\(?:A\\|B\\|C\\)" Additionally, in `apropos-parse-pattern', ".+" passed to `apropos-words-to-regexp' wolud be better if ".+?". Regards, Shigeru. From unknown Sat Aug 16 22:46:39 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Shigeru Fukaya Subject: bug#13946: closed (Re: bug#13946: 24.3; [PATCH] fix of apropos with words) Message-ID: References: <87ppouoje8.fsf@gnu.org> X-Gnu-PR-Message: they-closed 13946 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 13946@debbugs.gnu.org Date: Wed, 18 Dec 2013 04:48:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1387342082-17711-1" This is a multi-part message in MIME format... ------------=_1387342082-17711-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #13946: 24.3; [PATCH] fix of apropos with words which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 13946@debbugs.gnu.org. --=20 13946: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D13946 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1387342082-17711-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 13946-done) by debbugs.gnu.org; 18 Dec 2013 04:47:19 +0000 Received: from localhost ([127.0.0.1]:56436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vt92U-0004ab-Kn for submit@debbugs.gnu.org; Tue, 17 Dec 2013 23:47:18 -0500 Received: from mail-pd0-f177.google.com ([209.85.192.177]:56019) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vt92R-0004aS-W7 for 13946-done@debbugs.gnu.org; Tue, 17 Dec 2013 23:47:16 -0500 Received: by mail-pd0-f177.google.com with SMTP id q10so7689770pdj.36 for <13946-done@debbugs.gnu.org>; Tue, 17 Dec 2013 20:47:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=J0vUegjJpoSkFDu8RKi9l+jIuzj8D7tddkvXqNC+qxc=; b=c9F5XD1nTXUluHfsIS7TkZHJviIlvQbOnD5hQ0K4izIFR0Ke6B7+vVvuPRNgJ92TXl A2UpuYHtl/WbGrKLFb/3U7AwvBNzTDTbTP8eZ2y9uPRvki82EIxQq48pK4e+XF10dBdG g+wrXydACLXI5qY52VzhC0DaSwVo1ar8nFIrHehSQ3h5gm9IeLCBLT48CDRhajTugv6w 7rjY/RZP9sG02m5gQFXTyKSUPZnSCSLP9YOyyjzV27i+JE/Rb8GfSFGkshKf0P3CAb0O 5kCrZslyGvjgRwNZxa8olPmUjVGWofix4CTDqTaYiPcwIAXNw592SA8n1LhUkXUEtmQz 4PdA== X-Received: by 10.66.163.164 with SMTP id yj4mr31359810pab.91.1387342035013; Tue, 17 Dec 2013 20:47:15 -0800 (PST) Received: from tsparkle ([155.69.19.37]) by mx.google.com with ESMTPSA id qz9sm37822626pbc.3.2013.12.17.20.47.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Dec 2013 20:47:13 -0800 (PST) From: Chong Yidong To: Shigeru Fukaya Subject: Re: bug#13946: 24.3; [PATCH] fix of apropos with words References: Date: Wed, 18 Dec 2013 12:47:11 +0800 In-Reply-To: (Shigeru Fukaya's message of "Thu, 14 Mar 2013 00:21:29 +0900") Message-ID: <87ppouoje8.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 13946-done Cc: 13946-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Shigeru Fukaya writes: > `apropos' family with plural words returns unexpected symbols and are > annoying. It is because `apropos-words-to-regexp' doesn't work as > documented/expected. > > The following is revised `apropos-words-to-regexp'. Thanks, committed to trunk. ------------=_1387342082-17711-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 13 Mar 2013 15:23:08 +0000 Received: from localhost ([127.0.0.1]:51434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFnWE-0001J4-QM for submit@debbugs.gnu.org; Wed, 13 Mar 2013 11:23:07 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58832) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFnWB-0001Ia-NU for submit@debbugs.gnu.org; Wed, 13 Mar 2013 11:23:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFnUu-000275-3E for submit@debbugs.gnu.org; Wed, 13 Mar 2013 11:21:52 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:53251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFnUu-000270-0V for submit@debbugs.gnu.org; Wed, 13 Mar 2013 11:21:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFnUp-0002gP-7y for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2013 11:21:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFnUj-00024t-7R for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2013 11:21:39 -0400 Received: from mail-da0-x230.google.com ([2607:f8b0:400e:c00::230]:59041) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFnUj-00024l-16 for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2013 11:21:33 -0400 Received: by mail-da0-f48.google.com with SMTP id w4so456842dam.21 for ; Wed, 13 Mar 2013 08:21:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:mime-version:content-type :content-transfer-encoding:x-mailer:message-id; bh=1DvhxBmmHvaxI0dLbsZg/Qmrz/HOKJnPOIw9shqcmPE=; b=q+Slp8WwF7ZR5z2GqZZsGdkyDTynwq1EzjSAGPItqFwmTFNpzDIVIG1H5Hnu5U8YGu 0pjEZ4CNiiVsv2UGLHj9oijTpBCW+geyNn4mNwoUSQXwh1vJsJ/tjtWKetb7gMh72HAS CfZxH9Tabnh2SzOccSysMRwZogtMTAiBoj9D5P+WzLPZib3VLPbx/sz4C/mtSZCY04BM mpmZQ1Oa0QWPbiwQnq30NrLCfm1o3wBC1WrhrsnpyZSv36X2DIhObJMkYOJX4HUQ4PlQ dPhpFA/LWUheCLF9JOjlowWiH3+L0bd6Yky8dN3UELm3PYup+BiU8CB5x67Y4fHsQB92 NrwA== X-Received: by 10.68.212.104 with SMTP id nj8mr40937558pbc.197.1363188091886; Wed, 13 Mar 2013 08:21:31 -0700 (PDT) Received: from gmail.com (115x125x38x6.ap115.ftth.ucom.ne.jp. [115.125.38.6]) by mx.google.com with ESMTPS id iu10sm30047619pbc.13.2013.03.13.08.21.28 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 13 Mar 2013 08:21:30 -0700 (PDT) From: Shigeru Fukaya To: bug-gnu-emacs@gnu.org Subject: 24.3; [PATCH] fix of apropos with words Date: Thu, 14 Mar 2013 00:21:29 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: HidemaruMail 6.00 (WinNT,601) Message-Id: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) Hello, `apropos' family with plural words returns unexpected symbols and are annoying. It is because `apropos-words-to-regexp' doesn't work as documented/expected. The following is revised `apropos-words-to-regexp'. (defun apropos-words-to-regexp (words wild) "Make regexp matching any two of the words in WORDS." (if (null (cdr words)) (car words) ;; assure all words are independent objects for delq (setq words (mapcar 'copy-sequence words)) (mapconcat (lambda (w) (concat "\\(?:" w "\\)" ;; parens for synonyms wild "\\(?:" (mapconcat 'identity (delete-dups (delq w (copy-sequence words))) "\\|") "\\)")) (delete-dups (copy-sequence words)) "\\|"))) results: (apropos-words-to-regexp '("A" "B") ".*?") "\\(?:A\\).*?\\(?:B\\)\\|\\(?:B\\).*?\\(?:A\\)" (apropos-words-to-regexp '("A" "B" "C") ".*?") "\\(?:A\\).*?\\(?:B\\|C\\)\\|\\(?:B\\).*?\\(?:A\\|C\\)\\|\\(?:C\\).*?\\(?:A\\|B\\)" (apropos-words-to-regexp '("A" "B" "B") ".*?") "\\(?:A\\).*?\\(?:B\\)\\|\\(?:B\\).*?\\(?:A\\|B\\)" (apropos-words-to-regexp '("A" "A" "B" "C" "C") ".*?") "\\(?:A\\).*?\\(?:A\\|B\\|C\\)\\|\\(?:B\\).*?\\(?:A\\|C\\)\\|\\(?:C\\).*?\\(?:A\\|B\\|C\\)" Additionally, in `apropos-parse-pattern', ".+" passed to `apropos-words-to-regexp' wolud be better if ".+?". Regards, Shigeru. ------------=_1387342082-17711-1--