unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Using a newline character in the newstring in M-x replace-regexp
@ 2008-08-14 19:31 Corey Foote
  2008-08-14 22:54 ` Peter Dyballa
  0 siblings, 1 reply; 6+ messages in thread
From: Corey Foote @ 2008-08-14 19:31 UTC (permalink / raw
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 570 bytes --]


Hi,



I've got one more quick question for you guys. The string
I'd like to use as the newstring in M-x replace-regexp contains a few newline
characters. Normally, I insert newlines by typing C-q C-j, but this doesn't
work when calling this function. How do you specify a newline character when
making a call to M-x replace-regexp?



Thanks!


_________________________________________________________________
Got Game? Win Prizes in the Windows Live Hotmail Mobile Summer Games Trivia Contest
http://www.gowindowslive.com/summergames?ocid=TXT_TAGHM

[-- Attachment #2: Type: text/html, Size: 805 bytes --]

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

* Re: Using a newline character in the newstring in M-x replace-regexp
       [not found] <mailman.16702.1218742268.18990.help-gnu-emacs@gnu.org>
@ 2008-08-14 20:35 ` Xah
  2008-08-16 14:00   ` harven
  0 siblings, 1 reply; 6+ messages in thread
From: Xah @ 2008-08-14 20:35 UTC (permalink / raw
  To: help-gnu-emacs

On Aug 14, 12:31 pm, Corey Foote <coreyfo...@hotmail.com> wrote:
> Hi,
>
> I've got one more quick question for you guys. The string
> I'd like to use as the newstring in M-x replace-regexp contains a few newline
> characters. Normally, I insert newlines by typing C-q C-j, but this doesn't
> work when calling this function. How do you specify a newline character when
> making a call to M-x replace-regexp?

It works for me and should work in any emacs 22. For interactive use,
i think C-q C-j is actually the only way to insert newlines.

If you are calling this function in elisp, you can use “\n”. But
literal line feed should also work...

so i'm not sure what might be your problem?

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using a newline character in the newstring in M-x replace-regexp
  2008-08-14 19:31 Corey Foote
@ 2008-08-14 22:54 ` Peter Dyballa
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Dyballa @ 2008-08-14 22:54 UTC (permalink / raw
  To: Corey Foote; +Cc: help-gnu-emacs


Am 14.08.2008 um 21:31 schrieb Corey Foote:

> I'd like to use as the newstring in M-x replace-regexp contains a  
> few newline
> characters. Normally, I insert newlines by typing C-q C-j, but this  
> doesn't
> work when calling this function.


If it doesn't work, then you have a buggy GNU Emacs. Upgrade!

--
Greetings

   Pete

Email is a wonderful thing for people whose role in life is to be on  
top of things. But not for me; my role is to be on the bottom of  
things. What I do takes long hours of studying and uninterruptible  
concentration.
				– Donald Knuth







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

* Re: Using a newline character in the newstring in M-x replace-regexp
  2008-08-14 20:35 ` Using a newline character in the newstring in M-x replace-regexp Xah
@ 2008-08-16 14:00   ` harven
  2008-09-11  1:52     ` David Combs
  0 siblings, 1 reply; 6+ messages in thread
From: harven @ 2008-08-16 14:00 UTC (permalink / raw
  To: help-gnu-emacs


> It works for me and should work in any emacs 22. For interactive use,
> i think C-q C-j is actually the only way to insert newlines.

C-o   or   C-012 RET   also work for a query-replace.
C-o does not work by default for an incremental search.
The following code adds this shortcut to the incremental commands.

(define-key isearch-mode-map "\C-o"
           (lambda () (interactive)
             (isearch-process-search-char ?\n)))


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

* Re: Using a newline character in the newstring in M-x replace-regexp
  2008-08-16 14:00   ` harven
@ 2008-09-11  1:52     ` David Combs
  2008-09-11  5:12       ` Kevin Rodgers
  0 siblings, 1 reply; 6+ messages in thread
From: David Combs @ 2008-09-11  1:52 UTC (permalink / raw
  To: help-gnu-emacs

In article <804f53f5-8387-4b20-a4d5-2a2b4708d529@k30g2000hse.googlegroups.com>,
harven  <harven@free.fr> wrote:
>
>> It works for me and should work in any emacs 22. For interactive use,
>> i think C-q C-j is actually the only way to insert newlines.
>
>C-o   or   C-012 RET   also work for a query-replace.
>C-o does not work by default for an incremental search.
>The following code adds this shortcut to the incremental commands.
>
>(define-key isearch-mode-map "\C-o"
>           (lambda () (interactive)
>             (isearch-process-search-char ?\n)))

Looks nifty -- but what does it do?

1: what's the purpose of defining C-o?

2: what does that function/lambda-expr actually *do*
   when it gets called>
(like, how does it get a newline inserted?)

Unfortunately:

| isearch-process-search-char is a compiled Lisp function in `isearch'.
| (isearch-process-search-char CHAR)
| 
| Not documented.
| 
| [back]
 


Thanks,

David




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

* Re: Using a newline character in the newstring in M-x replace-regexp
  2008-09-11  1:52     ` David Combs
@ 2008-09-11  5:12       ` Kevin Rodgers
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2008-09-11  5:12 UTC (permalink / raw
  To: help-gnu-emacs

David Combs wrote:
> In article <804f53f5-8387-4b20-a4d5-2a2b4708d529@k30g2000hse.googlegroups.com>,
> harven  <harven@free.fr> wrote:
>>> It works for me and should work in any emacs 22. For interactive use,
>>> i think C-q C-j is actually the only way to insert newlines.
>> C-o   or   C-012 RET   also work for a query-replace.
>> C-o does not work by default for an incremental search.
>> The following code adds this shortcut to the incremental commands.
>>
>> (define-key isearch-mode-map "\C-o"
>>           (lambda () (interactive)
>>             (isearch-process-search-char ?\n)))
> 
> Looks nifty -- but what does it do?
> 
> 1: what's the purpose of defining C-o?

It's shorter and perhaps easier to remember than C-q C-j.

> 2: what does that function/lambda-expr actually *do*
>    when it gets called>
> (like, how does it get a newline inserted?)
> 
> Unfortunately:
> 
> | isearch-process-search-char is a compiled Lisp function in `isearch'.
> | (isearch-process-search-char CHAR)
> | 
> | Not documented.
> | 
> | [back]

If you follow the link to isearch, you'll see its definition, which has
this comment:

   ;; Append the char to the search string, update the message and 
re-search.

-- 
Kevin Rodgers
Denver, Colorado, USA





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

end of thread, other threads:[~2008-09-11  5:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.16702.1218742268.18990.help-gnu-emacs@gnu.org>
2008-08-14 20:35 ` Using a newline character in the newstring in M-x replace-regexp Xah
2008-08-16 14:00   ` harven
2008-09-11  1:52     ` David Combs
2008-09-11  5:12       ` Kevin Rodgers
2008-08-14 19:31 Corey Foote
2008-08-14 22:54 ` Peter Dyballa

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