emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add some aliases for re-related functions


From: Dmitry Gutov
Subject: Re: Add some aliases for re-related functions
Date: Sun, 3 May 2020 01:10:30 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

Allow me to bikeshed a little too.

On 03.05.2020 00:33, Stefan Monnier wrote:
While debating whether it’s effective to add prefixes to increase
discoverability, lets start with incremental and uncontroversial
changes. Let’s start from re-related functions since it seems that many
people agree on this. Here is a list of functions that I think could benefit
from an alias.

I don't have an opinion on the "re-" vs "regexp-" prefix, so I'll
concentrate on the non-prefix part, where the problem is to try and keep
things short.

Same.

replace-regexp-in-string        re-replace-in-string

LGTM.

+

replace-match                   re-replace-match

Maybe this can be shortened to `re-replace`?

re-replace sounds like it will take both the regexp and the replacement as argument. The 'match' word is meaningful.

string-match                    re-search-in-string
string-match-p          re-match-in-string-p

Hmm... a bit long for my taste.  How 'bout `re-search(-p)`?

re-match and re-match-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

How 'bout `re-submatch(-no-properties|beg|end)`?

It's ok. But I'd just prepend 're-' to existing functions instead.

looking-at                      re-match-after-point
looking-back                    re-match-before-point

[ 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).

`re-match` and `re-match-back`?

Both sound like they will move point.

The problem with this is that I proposed `re-search` to apply to strings
whereas I now propose `re-match` to apply to buffers.  So maybe it
should be `re-match-forward` and `re-match-backward`?

It's fairly hard to distinguish, without reading the docs, from re-search-forward and -backward.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]