all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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 replace-string for 1 line 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 ` 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 --
2006-08-17 15:07 replace-string for 1 line ld1976
2006-08-17 16:35 ` Drew Adams
     [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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.