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: Stefan Monnier
Subject: Re: Add some aliases for re-related functions
Date: Sat, 02 May 2020 17:33:27 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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

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

LGTM.

> replace-match                 re-replace-match

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

> 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)`?

> 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)`?

> 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.  ]

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

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`?

OTOH I really want to discourage the use of `looking-back` because it's
a inefficient hack with a weird semantics, so giving it a name symmetric
to that of `looking-at` is a bad idea.

> posix-                re-posix-

Sounds good, but it should also follow the renaming of the non-posix
version of the function.


        Stefan




reply via email to

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