emacs-devel
[Top][All Lists]
Advanced

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

Re: skeleton.el _ versus @


From: Stefan Monnier
Subject: Re: skeleton.el _ versus @
Date: Mon, 31 Mar 2003 12:40:35 -0500

> > The current code allows the following trick:
> > 
> >     "fun f (" @ ")" \n "{" \n _ \n "}"
> >
> > such that selecting a region and calling the skeleton will
> > put the region in the body of the function (because of the _)
> > and point will be put at the right place for you to enter the
> > arglist (because of the @).
> 
> This is using skeletons in "region" mode.  I am not changing region
> mode, or at least I can modify the @ behavior so that it works in region
> mode this way.

But I also want point to end up at the "args" position in simple
insertion which your patch would break.

> A multi-mode region is defined by a front-tag, the body and a back-tag. 
> Therefore skeletons look like
> 
> (nil  "<script language=\"JavaScript\">" @ "\n" _ "\n" @ "</script>" @)
> 
> where the @'s mark the front-tag and back-tag begin and end points and
> the _ marks the position of the point after insertion so that you can
> begin editing there.
> 
> However, I can imagine using an mmm-mode skeleton in region mode where I
> want to wrap the front-tag and back-tag around some existing text.  In
> that case, *I* want the point to end up at the beginning of the region,
> i.e., at the _ and *not* at the @.  This is clearly a case of
> conflicting goals.

There is no doubt that there are conflicting goals.  But in order
to change the current behavior, you'd have to demonstrate that your goal
is sufficiently more worthy to justify breaking existing skeletons.

Your example is rather weak in this case since the difference between
what skeleton does and what you'd like it to do is a addressed by
a mere C-f from the user after inserting the skeleton.

> A better skeleton for your purposes would be one which prompted the user
> for each of the function arguments using the recursive prompting mode of
> skeleton input.

I hate such modal interfaces, sorry.

As for how you could get what you want with the current skeleton,
how about something like:

 (nil  "<script language=\"JavaScript\">" @ '(setq skeleton-point nil)
       "\n" _ "\n" @ "</script>" @)


-- Stefan





reply via email to

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