[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
keyboard macro create function from list
From: |
Patrick Drechsler |
Subject: |
keyboard macro create function from list |
Date: |
Thu, 07 Jun 2007 02:18:44 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (gnu/linux) |
Hi,
I often have a list of variable names and need to create similar code
from this list. Here is an example:
The List (imagine 6-10 myvar's):
--8<---------------cut here---------------start------------->8---
myvar_Asometext
myvar_B1foo
--8<---------------cut here---------------end--------------->8---
Lets say the code layout should look like:
--8<---------------cut here---------------start------------->8---
m_<listmember_n>.SetBounds(0, 0, m_<listmember_n>.Width,
m_<listmember_n>.Height)
m_<listmember_n>.Show()
SplitContainer.Panel2.Controls.Add(m_<listmember_n>)
--8<---------------cut here---------------end--------------->8---
The output should look like this:
--8<---------------cut here---------------start------------->8---
m_Asometext.SetBounds(0, 0, m_Asometext.Width, m_Asometext.Height)
m_Asometext.Show()
SplitContainer.Panel2.Controls.Add(m_Asometext)
m_B1foo.SetBounds(0, 0, m_B1foo.Width, m_B1foo.Height)
m_B1foo.Show()
SplitContainer.Panel2.Controls.Add(m_B1foo)
--8<---------------cut here---------------end--------------->8---
At the moment I copy the list from another IDE into an Emacs scratch
buffer. Then I append one example layout to the scratch buffer. After
copying and marking the relevant region(s) I follow up by a multitude
of invocations of `M-x replace-string'. Although this is still faster
than working in the IDE I copy from, I feel that there is a better way
of using Emacs' abilities...
So, any ideas for accomplishing this more efficiently (using a current
Emacs version) are more than welcome ;-)
TIA
Patrick
--
I never used a logarithm in my life, and could not undertake to
extract the square root of four without misgivings.
(Georg Bernhard Shaw)
- keyboard macro create function from list,
Patrick Drechsler <=