unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: kai.grossjohann@gmx.net (Kai Großjohann)
Subject: Re: Problem positioning cursor
Date: Sat, 26 Apr 2003 16:06:16 +0200	[thread overview]
Message-ID: <84of2te4kn.fsf@lucy.is.informatik.uni-duisburg.de> (raw)
In-Reply-To: mailman.5188.1051270162.21513.help-gnu-emacs@gnu.org

Victor Kirk <Victor.Kirk@serco.com> writes:

> I've wrote a function to insert a skeleton for a java try-catch
> block, but I've run into a problem leaving the cursor in the
> correct place.

First of all, maybe you want to use skeletons rather than hand-coding
everything.  It will be easier to understand.

I think that skeletons can't do what you need, though.  There is a
change that adds the capability you need which has been committed to
the development release of Emacs in the last couple of days, or which
will be committed soon.

However, maybe you want to read up on skeletons anyway -- they might
come in useful for other things you are doing.

Failing the use of skeletons, a technique I suggest to use for the
hand-written functions is save-excursion.  For example, here is
something that inserts foo() and leaves point inside the parentheses:

    (insert "foo(")
    (save-excursion
      (insert ")")

I think you will find this much easier to understand that your
hand-coded remembering of positions, and thus it will be easier to
find the bugs.
-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)

       reply	other threads:[~2003-04-26 14:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.5188.1051270162.21513.help-gnu-emacs@gnu.org>
2003-04-26 14:06 ` Kai Großjohann [this message]
2003-04-26 15:24   ` Problem positioning cursor Oliver Scholz
2003-04-27 11:47     ` Kai Großjohann
2003-04-27 12:40       ` Oliver Scholz
2003-04-25 11:01 Victor Kirk

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=84of2te4kn.fsf@lucy.is.informatik.uni-duisburg.de \
    --to=kai.grossjohann@gmx.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).