Re: skeleton improvement

Pierre Courtieu <[email protected]> Thu, 24 Feb 2005 14:02:12 +0100
Newsgroups gmane.emacs.xemacs.design
Message-ID <[email protected]>
On 24 f=E9v 2005, Pierre Courtieu wrote:

> > It will insert:
> >=20
> >         if ( [0] ) {
> >                 [1]
> >         } else {
> >                 [2]
> >         }
> >=20
> > And write to minibuffer - 'Marks set: 3, use C-u C-SPC to jump next.'
> > Hope this is what you are looking for.
>=20
> This is exactly what I was looking for. Thanks a lot!

Well, after looking at it, specially to this kind of definition:

(defvar mc-if-skel
   '(nil
     > "if (" _ ") {" \n
     > '(progn (mc-push-mark) nil) \n
     > "}" '(progn (indent-according-to-mode) nil) \n
     > '(progn (mc-push-mark) nil)
     nil)
   "*Skeleton for if statement")

I still think that adding the '@' as a special marker telling "store this
position into skeleton-position" is a good idea. For example the above
statement becomes.:

(defvar mc-if-skel
   '(nil
     > "if (" _ ") {" \n > @ \n > "}" '(progn (indent-according-to-mode) =
nil) \n > @
     nil)
   "*Skeleton for if statement")

Then you can use add a hook skeleton-end-hook to store those positions in
mark-stack if you want (I plan to make another hook building a "hole" at
each position).

Moreover why do you need indent-according-to-mode? replacing it by >
wouldn't be the same?


Anyway thanks for the quick answer.

--
Pierre Courtieu