[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: elisp code for replacing every other occurence in a line?
From: |
Robert Thorpe |
Subject: |
Re: elisp code for replacing every other occurence in a line? |
Date: |
Mon, 12 May 2014 21:43:16 +0100 |
Frank Stutzman <stutzman@cat2.kjsl.com> writes:
> Nevermind....
>
> It took quite a while to get my brain into elisp mode. Once that happened I
> realized that my solution was write there on the help page for replace-string.
> Right there where it says you probably don't want to use replace-string.
> Pretty much the only real change I had to do was to use the COUNT option on
> search-forward.
You don't necessarily have to write any elisp at all for things like
this. If you can use replace-string or search-forward then you can use
a macro. Start recording with F3, do the search and replaces with
something like M-% then finish with F4. Then do M-x insert-kbd-macro
and it'll give you a bit of elisp code. You can turn that into a defun
and put into your init file if you want to.
BR,
Robert Thorpe