From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: Add some aliases for re-related functions Date: Sun, 03 May 2020 23:04:41 -0400 Message-ID: References: <7976B8C1-AFC7-4662-B750-6492EB70C0D5@gmail.com> Reply-To: rms@gnu.org Content-Type: text/plain; charset=Utf-8 Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="68506"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon May 04 05:05:22 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jVRQ1-000HjA-JF for ged-emacs-devel@m.gmane-mx.org; Mon, 04 May 2020 05:05:21 +0200 Original-Received: from localhost ([::1]:39734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVRQ0-0001oq-KW for ged-emacs-devel@m.gmane-mx.org; Sun, 03 May 2020 23:05:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVRPP-00015k-N6 for emacs-devel@gnu.org; Sun, 03 May 2020 23:04:43 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43786) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVRPP-0007pj-4P; Sun, 03 May 2020 23:04:43 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1jVRPN-0005sy-84; Sun, 03 May 2020 23:04:41 -0400 In-Reply-To: <7976B8C1-AFC7-4662-B750-6492EB70C0D5@gmail.com> (message from Yuan Fu on Sat, 2 May 2020 14:28:08 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:248761 Archived-At: [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > replace-regexp-in-string re-replace-in-string > replace-match re-replace-match > string-match re-search-in-string > string-match-p re-match-in-string-p > match-string re-matched-string > match-string-no-properties re-matched-string-no-properties > match-beginning re-match-beginning > match-end re-match-end > looking-at re-match-after-point > looking-back re-match-before-point > looking-at-p re-match-after-point-p > posix-search-forward re-posix-search-forward > posix-search-backward re-posix-search-backward > posix-looking-at re-posix-looking-at > posix-search-in-string re-posix-search-in-string Some of these are painfully long. This sort of systematization is desirable, all else being equal. But we have to minimize the costs also, and a longer name is a real cost. The functions whose names start with 'match-' are not limited to regexps. match-beginning and match-end are often used after search-forward. For brevity, I think it is better to keep those names unchanged. > replace-match match-replace That puts it into the 'match-' group, where it fits well. It, like those others, is for operating on a match found by another function. > replace-regexp-in-string replace-regexp-string That is parallel to replace-regexp. If we don't rename replace-regexp, let's pick a name for this that parallels it. > string-match re-search-string > string-match-p re-search-string-p Since what these do is search, they may as well be called 'search'. We can reserve 'match' to mean an anchored match. > looking-at re-match > looking-back re-match-back > looking-at-p re-match-p Those are nice and short. > posix-search-forward re-search-forward-posix > posix-search-backward re-search-backward-posix > posix-looking-at re-match-posix > posix-string-match re-search-string-posix -- Dr Richard Stallman Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)