unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* query-replace-regexp interactive replacement string
@ 2011-03-02 22:52 suvayu ali
  2011-03-03  8:03 ` Deniz Dogan
  0 siblings, 1 reply; 6+ messages in thread
From: suvayu ali @ 2011-03-02 22:52 UTC (permalink / raw)
  To: Emacs mailing list

Hi Emacs users,

I wanted to replace interactively all numbers in the text of an org-mode
document with the number in words, so I tried:

`C-M-% [0-9]+ RET \? RET'

But this gives me an error like this:

> Debugger entered--Lisp error: (error "Invalid use of `\\' in replacement text")
>   replace-match("\\?" t nil #("2" 0 1 (fontified t)) nil)
>   match-substitute-replacement("\\?" t nil)
>   perform-replace("[0-9]+" "\\?" t t nil nil nil nil nil)
>   query-replace-regexp("[0-9]+" "\\?" nil nil nil)
>   call-interactively(query-replace-regexp nil nil)
>   recursive-edit()
>   perform-replace("[0-9]+" "?" t t nil nil nil nil nil)
>   query-replace-regexp("[0-9]+" "?" nil nil nil)
>   call-interactively(query-replace-regexp nil nil)

Since the doc string of `query-replace-regexp' says the following:

> ...
> In TO-STRING, ...
> `\?' lets you edit the replacement text in the minibuffer
> at the given position for each replacement.
> ...

I am not sure what I did wrong. I am using GNU Emacs 24.0.50.1
(x86_64-unknown-linux-gnu, GTK+ Version 2.22.0)

Thanks for any thoughts.

-- 
Suvayu

Open source is the future. It sets us free.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: query-replace-regexp interactive replacement string
  2011-03-02 22:52 query-replace-regexp interactive replacement string suvayu ali
@ 2011-03-03  8:03 ` Deniz Dogan
  2011-03-03  8:11   ` Suvayu Ali
  0 siblings, 1 reply; 6+ messages in thread
From: Deniz Dogan @ 2011-03-03  8:03 UTC (permalink / raw)
  To: suvayu ali; +Cc: Emacs mailing list

2011/3/2 suvayu ali <fatkasuvayu+linux@gmail.com>:
> Hi Emacs users,
>
> I wanted to replace interactively all numbers in the text of an org-mode
> document with the number in words, so I tried:
>
> `C-M-% [0-9]+ RET \? RET'
>
> But this gives me an error like this:
>
>> Debugger entered--Lisp error: (error "Invalid use of `\\' in replacement text")
>>   replace-match("\\?" t nil #("2" 0 1 (fontified t)) nil)
>>   match-substitute-replacement("\\?" t nil)
>>   perform-replace("[0-9]+" "\\?" t t nil nil nil nil nil)
>>   query-replace-regexp("[0-9]+" "\\?" nil nil nil)
>>   call-interactively(query-replace-regexp nil nil)
>>   recursive-edit()
>>   perform-replace("[0-9]+" "?" t t nil nil nil nil nil)
>>   query-replace-regexp("[0-9]+" "?" nil nil nil)
>>   call-interactively(query-replace-regexp nil nil)
>
> Since the doc string of `query-replace-regexp' says the following:
>
>> ...
>> In TO-STRING, ...
>> `\?' lets you edit the replacement text in the minibuffer
>> at the given position for each replacement.
>> ...
>
> I am not sure what I did wrong. I am using GNU Emacs 24.0.50.1
> (x86_64-unknown-linux-gnu, GTK+ Version 2.22.0)
>

Weird, it doesn't work for me either.  However, if I use
M-x replace-regexp it does work. In "(emacs) Regexp Replace" it also
mentions \?.

   "If you want to enter part of the replacement string by hand each
time, use `\?' in the replacement string.  Each replacement will ask
you to edit the replacement string in the minibuffer, putting point
where the `\?' was."

-- 
Deniz Dogan



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: query-replace-regexp interactive replacement string
  2011-03-03  8:03 ` Deniz Dogan
@ 2011-03-03  8:11   ` Suvayu Ali
  2011-03-03  8:35     ` Deniz Dogan
  2011-03-03  8:39     ` Andreas Röhler
  0 siblings, 2 replies; 6+ messages in thread
From: Suvayu Ali @ 2011-03-03  8:11 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: Emacs mailing list

On Thu, 3 Mar 2011 09:03:38 +0100
Deniz Dogan <deniz.a.m.dogan@gmail.com> wrote:

> 2011/3/2 suvayu ali <fatkasuvayu+linux@gmail.com>:
> > Hi Emacs users,
> >
> > I wanted to replace interactively all numbers in the text of an
> > org-mode document with the number in words, so I tried:
> >
> > `C-M-% [0-9]+ RET \? RET'
> >
> > But this gives me an error like this:
> > ...
> >
> 
> Weird, it doesn't work for me either.  However, if I use
> M-x replace-regexp it does work. In "(emacs) Regexp Replace" it also
> mentions \?.
> 

Thank you for looking into this, I can also confirm that it works for me
with replace-regexp but not query-replace-regexp.

Could it be a bug?

-- 
Suvayu

Open source is the future. It sets us free.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: query-replace-regexp interactive replacement string
  2011-03-03  8:11   ` Suvayu Ali
@ 2011-03-03  8:35     ` Deniz Dogan
  2011-03-03  9:14       ` Suvayu Ali
  2011-03-03  8:39     ` Andreas Röhler
  1 sibling, 1 reply; 6+ messages in thread
From: Deniz Dogan @ 2011-03-03  8:35 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: Emacs mailing list

2011/3/3 Suvayu Ali <fatkasuvayu+linux@gmail.com>:
> On Thu, 3 Mar 2011 09:03:38 +0100
> Deniz Dogan <deniz.a.m.dogan@gmail.com> wrote:
>
>> 2011/3/2 suvayu ali <fatkasuvayu+linux@gmail.com>:
>> > Hi Emacs users,
>> >
>> > I wanted to replace interactively all numbers in the text of an
>> > org-mode document with the number in words, so I tried:
>> >
>> > `C-M-% [0-9]+ RET \? RET'
>> >
>> > But this gives me an error like this:
>> > ...
>> >
>>
>> Weird, it doesn't work for me either.  However, if I use
>> M-x replace-regexp it does work. In "(emacs) Regexp Replace" it also
>> mentions \?.
>>
>
> Thank you for looking into this, I can also confirm that it works for me
> with replace-regexp but not query-replace-regexp.
>
> Could it be a bug?
>

I'm by no means an expert on the subject, I didn't even know about the
"\?" feature, but now we're two people confused by the documentation
vs. the behavior. If it's not a functionality bug, it's a
documentation bug. Please file a report.

Thanks,
Deniz Dogan



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: query-replace-regexp interactive replacement string
  2011-03-03  8:11   ` Suvayu Ali
  2011-03-03  8:35     ` Deniz Dogan
@ 2011-03-03  8:39     ` Andreas Röhler
  1 sibling, 0 replies; 6+ messages in thread
From: Andreas Röhler @ 2011-03-03  8:39 UTC (permalink / raw)
  To: help-gnu-emacs

Am 03.03.2011 09:11, schrieb Suvayu Ali:
> On Thu, 3 Mar 2011 09:03:38 +0100
> Deniz Dogan<deniz.a.m.dogan@gmail.com>  wrote:
>
>> 2011/3/2 suvayu ali<fatkasuvayu+linux@gmail.com>:
>>> Hi Emacs users,
>>>
>>> I wanted to replace interactively all numbers in the text of an
>>> org-mode document with the number in words, so I tried:
>>>
>>> `C-M-% [0-9]+ RET \? RET'
>>>
>>> But this gives me an error like this:
>>> ...
>>>
>>
>> Weird, it doesn't work for me either.  However, if I use
>> M-x replace-regexp it does work. In "(emacs) Regexp Replace" it also
>> mentions \?.
>>
>
> Thank you for looking into this, I can also confirm that it works for me
> with replace-regexp but not query-replace-regexp.
>
> Could it be a bug?
>

Hi,

can confirm this with

GNU Emacs 23.2.94.1 (i686-pc-linux-gnu, GTK+ Version 2.18.6) of 2011-02-25

Seems worth a bug-report

Thanks


Andreas

--
https://code.launchpad.net/~a-roehler/python-mode/python-mode-components
https://code.launchpad.net/s-x-emacs-werkstatt/




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: query-replace-regexp interactive replacement string
  2011-03-03  8:35     ` Deniz Dogan
@ 2011-03-03  9:14       ` Suvayu Ali
  0 siblings, 0 replies; 6+ messages in thread
From: Suvayu Ali @ 2011-03-03  9:14 UTC (permalink / raw)
  To: Emacs mailing list

Hi Deniz and Andreas,

I have filed a bug report,

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8161

Thanks,

-- 
Suvayu

Open source is the future. It sets us free.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-03-03  9:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-02 22:52 query-replace-regexp interactive replacement string suvayu ali
2011-03-03  8:03 ` Deniz Dogan
2011-03-03  8:11   ` Suvayu Ali
2011-03-03  8:35     ` Deniz Dogan
2011-03-03  9:14       ` Suvayu Ali
2011-03-03  8:39     ` Andreas Röhler

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