[PLUG] Changing Case in a List of Names
Rogan Creswick
creswick at gmail.com
Thu Apr 16 03:08:45 UTC 2009
On Wed, Apr 15, 2009 at 7:06 PM, Jason Dagit <dagitj at gmail.com> wrote:
>
> You can use emacs to interactively record a macro for this purpose.
> In fact, since I prefer programming by demonstration for these sorts
> of tasks I usually use emacs and teach it what to do.
>
I also tend to take Jason's approach unless I have more than 2 files
that need the same manipulations.
Just to add -- once you've developed a functional macro that you think
you'll need again:
M-x name-last-kbd-macro to give it a name
(now you can run it by name too, if you want -- it's just like any
other emacs function now that it has a name! eg: M-x myMacro)
Then, if you want to save it, just pop open your .emacs and run:
M-x insert-kbd-macro
It will prompt you for the name, and then write it out at the point,
and every new emacs session will have access to that as a new
function. (so you can do things like bind it to a keystroke, rename
it, use it in new macros, even edit it if you're incredibly brave ;)
--Rogan
> Open the file in question. Then type C-x C-(, this will begin
> recording a macro. Then hit C-a for beginning of line, M-c, or M-x
> capitalize-word, then hit C-n for the next line. Now type C-x C-) to
> end the macro. You can now repeat this macro with C-u N C-x C-e,
> where N is the number of times you want to execute the macro. Or just
> C-x C-e if you want to run the macro once. After you memorize the
> basic dance of creating a line by line macro the only hard part is
> figuring out what commands to do in the middle, M-x capitalize-word in
> this case. But, the nice part is you get a fairly general formula for
> text manipulation that takes just a few minutes to apply -- and you
> don't have to learn a programming language if you don't want to.
>
> I hope you find this useful in the future.
> Jason
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
More information about the PLUG
mailing list