unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Patrick Drechsler <patrick@pdrechsler.de>
To: help-gnu-emacs@gnu.org
Subject: keyboard macro create function from list
Date: Thu, 07 Jun 2007 02:18:44 +0200	[thread overview]
Message-ID: <87ejkor50b.fsf@pdrechsler.de> (raw)

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)

             reply	other threads:[~2007-06-07  0:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-07  0:18 Patrick Drechsler [this message]
2007-06-07 19:33 ` keyboard macro create function from list Peter Lee
2007-06-09  7:54   ` Patrick Drechsler

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=87ejkor50b.fsf@pdrechsler.de \
    --to=patrick@pdrechsler.de \
    --cc=help-gnu-emacs@gnu.org \
    /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).