unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Paul Pogonyshev <pogonyshev@gmx.net>
Cc: rms@gnu.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: [patch] Re: regexp repacement, how to present replacement to user?
Date: Sun, 21 Oct 2007 23:43:34 +0300	[thread overview]
Message-ID: <87k5pg6wvk.fsf@jurta.org> (raw)
In-Reply-To: <200710212200.38685.pogonyshev@gmx.net> (Paul Pogonyshev's message of "Sun\, 21 Oct 2007 22\:00\:38 +0300")

> These functions basically perform part of what `replace-match' does.
> The latter substitutes replacement group references (`\N' and `\&')
> and replaces match in the buffer with the result text.  Proposed
> functions only generate and return that text, without modyfing the
> buffer.

Since new functions are similar to `replace-match', I think they
should also have similar names, e.g. `replace-match-string' or
`replace-match-as-string' meaning that it returns the replacement
as a string.  Also I think it should have exactly the same arguments
as `replace-match'.  And one function should be enough - there is no need
for -no-properties function because properties can be easily stripped
on the returned string when needed.

> Currently, Emacs doesn't use this or similar functionality to my
> knowledge.  However, this can be used in UI to present the user.
> Especially useful if the user doesn't write regular expression and
> replacement himself, but instead invokes some command that uses a
> predefined regexp written by someone else.  E.g., for instance, it
> would be quite cryptic if a user saw
>
>     Replace \\([[:digit:]]+\\)\\.\\([[:digit:]]+\\) with \1,\2 (decimal comma)?
>
> since he doesn't really care how this works internally at all.
> Instead, seeing
>
>     Replace 12.345 with 12,345 (decimal comma)?
>
> is more understandable.

I think there should be an option that will enable such understandable
replacements in the prompt (but not for multi-line replacements).

-- 
Juri Linkov
http://www.jurta.org/emacs/

  reply	other threads:[~2007-10-21 20:43 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-13 14:00 regexp repacement, how to present replacement to user? Paul Pogonyshev
2007-10-14 22:50 ` Juri Linkov
2007-10-15  3:20   ` Stefan Monnier
2007-10-15  5:57     ` David Kastrup
2007-10-15 20:28       ` Paul Pogonyshev
2007-10-16 23:54         ` Juri Linkov
2007-10-17  6:06           ` David Kastrup
2007-10-17 19:25           ` Paul Pogonyshev
2007-10-20 13:53             ` [patch] " Paul Pogonyshev
2007-10-21 16:26               ` Richard Stallman
2007-10-21 19:00                 ` Paul Pogonyshev
2007-10-21 20:43                   ` Juri Linkov [this message]
2007-10-21 21:15                     ` Paul Pogonyshev
2007-10-22  1:22                   ` Stefan Monnier
2007-10-26  3:48                     ` Richard Stallman
2007-10-28 14:41                       ` Paul Pogonyshev
2007-10-29  9:22                         ` Richard Stallman
2007-10-30 14:16                           ` Juri Linkov
2007-10-31  7:46                             ` Richard Stallman
2007-10-31 21:39                               ` Paul Pogonyshev
2007-11-01  7:32                                 ` Richard Stallman
2007-11-02 20:58                                   ` Paul Pogonyshev
2007-11-10 15:01                                     ` Paul Pogonyshev
2007-11-11  5:21                                       ` Richard Stallman
2007-11-10 21:54                                     ` Juri Linkov
2007-10-23  7:12                   ` Richard Stallman
2007-10-23  8:16                     ` David Kastrup
2007-10-23 17:53                       ` Richard Stallman
2007-10-23 19:03                         ` Lennart Borgman (gmail)
2007-10-24  8:32                           ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k5pg6wvk.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=pogonyshev@gmx.net \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).