From: Chris McMahan <cmcmahan@thenumber1spelledout.net>
Subject: Re: How can I customize this repetive edit?
Date: 22 Jan 2004 16:12:38 -0500 [thread overview]
Message-ID: <uad4fvgah.fsf@thenumber1spelledout.net> (raw)
In-Reply-To: mailman.1171.1074804795.928.help-gnu-emacs@gnu.org
Emacs macros would be good here.
Just start recording a keyboard macro C-x (
Execute the keyboard commands to reformat your text
Stop the macro recording C-x )
Here's a BASIC macro that does what you want.
(fset 'foo
[?\C- ?\M-f ?\C-w ?\C-e ?= ?\" ?\C-y ?\" ?\C-a ?\C- ?\M-f ?\M-b ?\C-w ?\C-e ?\; ?\C-a ?\C-n])
Load this by placing your cursor after the closing ) above and typing C-x e
Then load your file, place the cursor on the first line of text, and
type M-x foo to execute the macro
- Chris
exits funnel <exitsfunnel@yahoo.com> writes:
> Hello,
>
> I have a text file which contains a coupld of hundred
> lines which look like this:
>
> >foo EAL_FOO
>
> I need them to look like this:
>
> > EAL_FOO="foo";
>
> Note that '>' is not part of the line but included to
> denote the beginning of the line (ie, the foo in the
> first example is flush with the beginning of the line
> while line in the second example starts with two
> spaces. Also note the EAL_ is fixed but foo can take
> any value though the case of foo and FOO respectively
> will always adhere to the pattern in the example.
>
> I really don't want to make all these changes by hand.
> I'm pretty new to EMACS but it seems this should be
> doable (everything else is :) ). If anyone could
> point me in the right direction I'd really appreciate
> it.
>
> -exits
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool. Try it!
> http://webhosting.yahoo.com/ps/sb/
>
>
--
(. .)
=ooO=(_)=Ooo========================
Chris McMahan | cmcmahan-at-one.net
====================================
next parent reply other threads:[~2004-01-22 21:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1171.1074804795.928.help-gnu-emacs@gnu.org>
2004-01-22 21:12 ` Chris McMahan [this message]
2004-01-22 21:37 ` How can I customize this repetive edit? Johan Bockgård
2004-01-22 22:49 ` Stefan Monnier
2004-01-23 17:12 ` Jeff
2004-01-22 20:36 exits funnel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=uad4fvgah.fsf@thenumber1spelledout.net \
--to=cmcmahan@thenumber1spelledout.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).