From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: kai.grossjohann@gmx.net (Kai =?iso-8859-1?q?Gro=DFjohann?=) Newsgroups: gmane.emacs.help Subject: Re: Problem positioning cursor Date: Sat, 26 Apr 2003 16:06:16 +0200 Organization: University of Duisburg, Germany Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <84of2te4kn.fsf@lucy.is.informatik.uni-duisburg.de> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1051366276 30540 80.91.224.249 (26 Apr 2003 14:11:16 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 26 Apr 2003 14:11:16 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 26 16:11:15 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 199QOD-0007un-00 for ; Sat, 26 Apr 2003 16:10:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 199QNp-0000A0-09 for gnu-help-gnu-emacs@m.gmane.org; Sat, 26 Apr 2003 10:10:29 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!peernews3.colt.net!newsfeed.stueberl.de!fu-berlin.de!uni-berlin.de!pd9e1e40f.dip.t-dialin.NET!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 Original-NNTP-Posting-Host: pd9e1e40f.dip.t-dialin.net (217.225.228.15) Original-X-Trace: fu-berlin.de 1051366119 9561910 217.225.228.15 (16 [73968]) Mail-Copies-To: never User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:Y5lg8QdqO33ZFZ0DDSheVxhWnII= Original-Xref: shelby.stanford.edu gnu.emacs.help:112359 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:8859 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:8859 Victor Kirk 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)