From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Add some aliases for re-related functions Date: Sun, 3 May 2020 02:13:42 +0300 Message-ID: <2a5344e3-999c-bb60-3c27-a9e9e6c256da@yandex.ru> References: <7976B8C1-AFC7-4662-B750-6492EB70C0D5@gmail.com> <1f156067-9bf3-e588-4306-9d673a2a27b9@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="117496"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 Cc: Yuan Fu , Emacs developers To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 03 01:14:27 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 1jV1L0-000UR4-Mk for ged-emacs-devel@m.gmane-mx.org; Sun, 03 May 2020 01:14:26 +0200 Original-Received: from localhost ([::1]:49072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jV1Kz-0000jM-NJ for ged-emacs-devel@m.gmane-mx.org; Sat, 02 May 2020 19:14:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jV1KO-0008Rv-H5 for emacs-devel@gnu.org; Sat, 02 May 2020 19:13:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jV1KN-0007tG-Bo for emacs-devel@gnu.org; Sat, 02 May 2020 19:13:48 -0400 Original-Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:33511) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jV1KM-0007sK-UD for emacs-devel@gnu.org; Sat, 02 May 2020 19:13:46 -0400 Original-Received: by mail-wr1-x42d.google.com with SMTP id h9so6097660wrt.0 for ; Sat, 02 May 2020 16:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ndU+tCDAkDowsxEYyDMjB6enESw2CLrP4HkEOlL4LwI=; b=Lbf5b2TQJXVNJb+HYwREq8qTrqZ1FwQhvMv3pvPdwI+hHDc4hOaarT/+NfEmNJTPNg xrFk4RVrQcY0fjHa4uHTbLyV0NSAtOnwA99Ch2lKRJs3vwJFu+H0J5uP1GxSDFkfOSbs S9kqW/TGSncdtLc9J1tcuPfUyBrh2QNZdGTp/IVbrYHLKXtR0uVytt0gcsAyMWB+O9X2 Y13fA/Zty31W1cjDSH5Q570JXPDIo2rkvO1E7uzKv0PRbxYGNA5Zd+f156zZSr9LCrZO kPuxyayI6tCIDFXBEFvcM8Lc47PWpbYm7iQuyFJUMySv5tcC+14ivSq6x7VcklTk877u 8Fpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ndU+tCDAkDowsxEYyDMjB6enESw2CLrP4HkEOlL4LwI=; b=XTT+wm+tjpw8pZMNURoFJztMlPYQKhT3JB15ZiyQqGABWKcBXQ8OXGQCmuXaomGXdk rRM+yFwEjnHGUm2SQW358y6X39aeV4ojeicv8myNpPhgek9pZ7UlTzrOkp7Vk5NJBBaV qfiKvddZ64bV2BexOMRM83EyIobGV2faZgT/VvOXUuI9TJpFh66dD0kfH3CehaocIP/L sQem2kaf1KegowDMY/TSxcpF9MlIBjf7RU0MaPFazuvcDXwNp01PN0EyF7KYu/9WjbkK Kb3JAv4t1kqf0g0Vy+15LL8gkQGiPcA27VYm2ivGMhYBdf1Y0C7NSONOJeNmEf1HOsfV ChDg== X-Gm-Message-State: AGi0Pub3Ef9HxAn67SBSpTnvP35CCBRwyEWHGNj3/Egw7DDH1VwUxqAf 9Bhyw6cCOL3rSXnvapQ5ByvU7slehDg= X-Google-Smtp-Source: APiQypJyPXHRXF9oczWDC4G6HCB2LHFIinhNBVA8vpLpatr4qZsjzcrLj45qVVuDSMG2PbI0YIe/Jg== X-Received: by 2002:a05:6000:1008:: with SMTP id a8mr11709736wrx.189.1588461225163; Sat, 02 May 2020 16:13:45 -0700 (PDT) Original-Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id v7sm6027644wmg.3.2020.05.02.16.13.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 02 May 2020 16:13:44 -0700 (PDT) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=raaahh@gmail.com; helo=mail-wr1-x42d.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::42d 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:248606 Archived-At: On 03.05.2020 01:49, Stefan Monnier wrote: >>> [ I'm trying to use "search" and "match" in the way it's used in >>> traditional regexp libraries. ] >> Guess I'm unfamiliar with said libraries. I'd suggest re-looking-at and >> re-looking-back (or whatever, like, don't create an alias for the last >> one if we don't want to). > > Most of the literature on regular expressions concentrates on the > problem of finding whether a given string matches a given regexp, where > "matching" here means that the regexp matches the whole string. Right. Buffers are an Emacs specific. > Think of it as the case where the regexp starts with \` and ends with \' > > Then there's the relaxation of "finding the longest match" (what we > call `looking-at`) and then "finding the leftmost longest match" (what > we call `string-match`). looking-at being a special case of re-search-forward, I take? > Those two have traditionally be named `re_match` and `re_search` > respectively in C libraries (as can be seen in `src/regexp-emacs.c`). Yes, ok. But we also need names to distinguish that things happen in a buffer. So far we've used 'search' for those. Using the term 'search' for matching in strings might be a significant change, given existing expectations. > PS: BTW, `looking-back` doesn't do a "match" of the "longest match that > ends at point" but a "search" for the "rightmost longest match that ends > at point" since it uses `re-search-backward` internally. It's a weird function, I agree. Though it's proved to be a handy one.