From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#27659: 26.0.50; Add string-matched-text: string-match + match-string Date: Wed, 19 Jul 2017 17:54:28 -0700 (PDT) Message-ID: <770f8fbd-343d-4bbc-bbf8-9a9cfe87367e@default> References: <87fue2rxm1.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1500512120 20166 195.159.176.226 (20 Jul 2017 00:55:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 20 Jul 2017 00:55:20 +0000 (UTC) To: Tino Calancha , 27659@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 20 02:55:16 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXzkD-0004iW-UC for geb-bug-gnu-emacs@m.gmane.org; Thu, 20 Jul 2017 02:55:10 +0200 Original-Received: from localhost ([::1]:35550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXzkJ-0005GV-F8 for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Jul 2017 20:55:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXzkB-0005F8-H2 for bug-gnu-emacs@gnu.org; Wed, 19 Jul 2017 20:55:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXzk6-0004tc-ME for bug-gnu-emacs@gnu.org; Wed, 19 Jul 2017 20:55:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45667) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dXzk6-0004tO-IJ for bug-gnu-emacs@gnu.org; Wed, 19 Jul 2017 20:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dXzk6-0003fB-BG for bug-gnu-emacs@gnu.org; Wed, 19 Jul 2017 20:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Jul 2017 00:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27659 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27659-submit@debbugs.gnu.org id=B27659.150051208114052 (code B ref 27659); Thu, 20 Jul 2017 00:55:02 +0000 Original-Received: (at 27659) by debbugs.gnu.org; 20 Jul 2017 00:54:41 +0000 Original-Received: from localhost ([127.0.0.1]:48344 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXzjk-0003eY-9o for submit@debbugs.gnu.org; Wed, 19 Jul 2017 20:54:41 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:34605) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXzji-0003eL-8T for 27659@debbugs.gnu.org; Wed, 19 Jul 2017 20:54:38 -0400 Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v6K0sVZA006959 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Jul 2017 00:54:31 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v6K0sUIG002992 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Jul 2017 00:54:31 GMT Original-Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v6K0sUcB030505; Thu, 20 Jul 2017 00:54:30 GMT In-Reply-To: <87fue2rxm1.fsf@calancha-pc> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6770.5000 (x86)] X-Source-IP: userv0021.oracle.com [156.151.31.71] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:134773 Archived-At: > (when (string-match "[[:alpha:]]+-\\([0-9]+\\)" str) > (match-string 1 str)) > is equivalent to: > (string-matched-text "[[:alpha:]]+-\\([0-9]+\\)" str 1) My own opinion, FWIW, is that the former is much clearer and is sufficiently succinct. YAGNI. [FWIW2: I would write the former as (and (string-match ...) (match-string...)), not as (when (string-match ...) (match-string...)). I follow the Common Lisp convention of using `when' to indicate (to a human) that the return value is not important (the function is used for side effects only). I don't expect a human reader to look for a `nil' return value from `when', for instance.]