unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Gary Wessle <phddas@yahoo.com>
To: help-gnu-emacs@gnu.org
Subject: a function to enter string
Date: 20 Feb 2007 07:27:52 +1100	[thread overview]
Message-ID: <m38xetriyf.fsf@localhost.localdomain> (raw)

Hi

I have this key macro in my emacs which puts "#include <string>" in
the first blank line in the buffer, also another key macro which puts
the string "std::string" at the point.

(fset 'str
   [?\M-<?\M-} ?# ?i ?n ?c ?l ?u ?d ?e ?  ?< ?s ?t ?r ?i ?n ?g ?>
   return])

(fset ':s
   "std::string")

I want when I type M-x :s  which is the second key macro above, it
puts the string "std::string" at point as well as checks to see if
"#include <string>" is at the top of the buffer, if not it inserts
it so that I don't have to do it.

how can this be done?

many thanks.

             reply	other threads:[~2007-02-19 20:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-19 20:27 Gary Wessle [this message]
2007-02-19 23:28 ` a function to enter string Pascal Bourguignon
2007-02-20 16:06   ` Mathias Dahl
2007-02-21 19:12   ` Gary Wessle
2007-02-20  8:30 ` Gordon Beaton

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=m38xetriyf.fsf@localhost.localdomain \
    --to=phddas@yahoo.com \
    --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).