unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* replace-string for 1 line
@ 2006-08-17 15:07 ld1976
  2006-08-17 16:35 ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: ld1976 @ 2006-08-17 15:07 UTC (permalink / raw)



Hello.
Say I want to carry out a replace command, but just for 1 line and not the
rest of the docuemnt, is there a way to do that? I have looked and couldn't
find it.
Thanks,
-- 
View this message in context: http://www.nabble.com/replace-string-for-1-line-tf2121982.html#a5853003
Sent from the Emacs - Help forum at Nabble.com.

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

* RE: replace-string for 1 line
  2006-08-17 15:07 ld1976
@ 2006-08-17 16:35 ` Drew Adams
  0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2006-08-17 16:35 UTC (permalink / raw)


    Say I want to carry out a replace command, but just for 1 line
    and not the rest of the docuemnt, is there a way to do that?

If you use transient-mark-mode (I recommend it), then just select the line,
then do the replacement. Many other commands and functions also operate on
the region, if it is active.

If you don't use transient-mark-mode, then narrow to that line: Select the
line, then `C-x n n'. Then do your replacement - only the region is visible,
so only the region is affected. Use `C-x n w' to widen, afterward. To do
this in Emacs Lisp, use `narrow-to-region' and `widen'.

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

* Re: replace-string for 1 line
       [not found] <mailman.5278.1155831504.9609.help-gnu-emacs@gnu.org>
@ 2006-08-17 16:38 ` B. T. Raven
  2006-08-17 16:40 ` Pascal Bourguignon
  1 sibling, 0 replies; 4+ messages in thread
From: B. T. Raven @ 2006-08-17 16:38 UTC (permalink / raw)



"ld1976" <lior_dagan@yahoo.com> wrote in message
news:mailman.5278.1155831504.9609.help-gnu-emacs@gnu.org...
>
> Hello.
> Say I want to carry out a replace command, but just for 1 line and not
the
> rest of the docuemnt, is there a way to do that? I have looked and
couldn't
> find it.
> Thanks,
> --
> View this message in context:
http://www.nabble.com/replace-string-for-1-line-tf2121982.html#a5853003
> Sent from the Emacs - Help forum at Nabble.com.
>
>
>

Type: (prompts are in quotes)

M-%
"Query replace" string1
"with:" string2
<spacebar>
q

Point is left after 2nd instance of string1.

Ed

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

* Re: replace-string for 1 line
       [not found] <mailman.5278.1155831504.9609.help-gnu-emacs@gnu.org>
  2006-08-17 16:38 ` replace-string for 1 line B. T. Raven
@ 2006-08-17 16:40 ` Pascal Bourguignon
  1 sibling, 0 replies; 4+ messages in thread
From: Pascal Bourguignon @ 2006-08-17 16:40 UTC (permalink / raw)


ld1976 <lior_dagan@yahoo.com> writes:

> Hello.
> Say I want to carry out a replace command, but just for 1 line and not the
> rest of the docuemnt, is there a way to do that? I have looked and couldn't
> find it.

Just select that line, and M-x replace-regexp RET ...

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

PLEASE NOTE: Some quantum physics theories suggest that when the
consumer is not directly observing this product, it may cease to
exist or will exist only in a vague and undetermined state.

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

end of thread, other threads:[~2006-08-17 16:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.5278.1155831504.9609.help-gnu-emacs@gnu.org>
2006-08-17 16:38 ` replace-string for 1 line B. T. Raven
2006-08-17 16:40 ` Pascal Bourguignon
2006-08-17 15:07 ld1976
2006-08-17 16:35 ` Drew Adams

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