help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem positioning cursor


From: Kai Großjohann
Subject: Re: Problem positioning cursor
Date: Sat, 26 Apr 2003 16:06:16 +0200
User-agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.3.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]