unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Skeleton & Abbrev
@ 2002-12-27  1:31 Tennis Smith
  2002-12-27 20:19 ` Kai Großjohann
  0 siblings, 1 reply; 5+ messages in thread
From: Tennis Smith @ 2002-12-27  1:31 UTC (permalink / raw)


Hi,

I'm trying to build some skeletons for tcl and auto-expand them
with abbrev just like the description here: 

http://www.emacswiki.org/cgi-bin/wiki.pl?SkeletonMode

My definition looks like this:

(define-abbrev tcl-mode-abbrev-table "_if"
"" 'tcl-if)

(define-skeleton tcl-if
  "A simple tcl if skeleton" nil
  \n 
  "if { "
  _
  " } {"
  \n \n
  "} else {"
  \n \n
  "}"
)

(setq skeleton-end-hook nil)


So, when I type in _if in a tcl buffer, it should auto-expand to a new 
"if" statement stub. But, it doesn't do anything. I've turned on abbrev
mode and skeleton, but it doesn't make any difference.  Anyone have any
idea why? 

TIA,
-Tennis

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Skeleton & Abbrev
  2002-12-27  1:31 Skeleton & Abbrev Tennis Smith
@ 2002-12-27 20:19 ` Kai Großjohann
  2002-12-29 16:06   ` Tennis Smith
  0 siblings, 1 reply; 5+ messages in thread
From: Kai Großjohann @ 2002-12-27 20:19 UTC (permalink / raw)


tennis_smith@yahoo.com (Tennis Smith) writes:

> So, when I type in _if in a tcl buffer, it should auto-expand to a new 
> "if" statement stub. But, it doesn't do anything. I've turned on abbrev
> mode and skeleton, but it doesn't make any difference.

Hm.  Underscore looks suspicious.  How about you try another abbrev,
such as ifif?  Remember to type whitespace before and after the abbrev.

-- 
Ambibibentists unite!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Skeleton & Abbrev
  2002-12-27 20:19 ` Kai Großjohann
@ 2002-12-29 16:06   ` Tennis Smith
  2002-12-29 16:55     ` Kai Großjohann
  0 siblings, 1 reply; 5+ messages in thread
From: Tennis Smith @ 2002-12-29 16:06 UTC (permalink / raw)


kai.grossjohann@uni-duisburg.de (Kai Großjohann wrote in message news:<847kdvkyfc.fsf@lucy.cs.uni-dortmund.de>...
> tennis_smith@yahoo.com (Tennis Smith) writes:
> 
> > So, when I type in _if in a tcl buffer, it should auto-expand to a new 
> > "if" statement stub. But, it doesn't do anything. I've turned on abbrev
> > mode and skeleton, but it doesn't make any difference.
> 
> Hm.  Underscore looks suspicious.  How about you try another abbrev,
> such as ifif?  Remember to type whitespace before and after the abbrev.

Thanks, that worked. :)  Also, how do I pass a var to the skeleton?  
For example:

(define-skeleton tcl-proc
  "A simple tcl proc skeleton" nil
  \n
  "#\n#\n#\n"
  "proc  PROC_NAME {  } {"
  \n
  _
  \n
  "} # end PROC_NAME "
)

How do I make "PROC_NAME" the contents of a var I pass at invocation time?

TIA,
-Tennis

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Skeleton & Abbrev
  2002-12-29 16:06   ` Tennis Smith
@ 2002-12-29 16:55     ` Kai Großjohann
  2002-12-30  2:33       ` Tennis Smith
  0 siblings, 1 reply; 5+ messages in thread
From: Kai Großjohann @ 2002-12-29 16:55 UTC (permalink / raw)


tennis_smith@yahoo.com (Tennis Smith) writes:

> How do I make "PROC_NAME" the contents of a var I pass at invocation time?

I'm not sure that define-skeleton is the right way to do that.

Do you want the user to type in the name of the procedure?
Investigate "interactors" in the skeleton documentation.

If you really want to call the skeleton programmatically and pass
args to it, I suggest that you instead write a function which invokes
skeleton-insert.  That function can then receive arguments.
-- 
Ambibibentists unite!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Skeleton & Abbrev
  2002-12-29 16:55     ` Kai Großjohann
@ 2002-12-30  2:33       ` Tennis Smith
  0 siblings, 0 replies; 5+ messages in thread
From: Tennis Smith @ 2002-12-30  2:33 UTC (permalink / raw)


kai.grossjohann@uni-duisburg.de (Kai Großjohann wrote in message news:<84el80pxx6.fsf@lucy.cs.uni-dortmund.de>...
> tennis_smith@yahoo.com (Tennis Smith) writes:
> 
> > How do I make "PROC_NAME" the contents of a var I pass at invocation time?
> 
> I'm not sure that define-skeleton is the right way to do that.
> 
> Do you want the user to type in the name of the procedure?
> Investigate "interactors" in the skeleton documentation.
> 
> If you really want to call the skeleton programmatically and pass
> args to it, I suggest that you instead write a function which invokes
> skeleton-insert.  That function can then receive arguments.

I got it. :)  Here's all that's needed for a *simple* var to be passed:

(define-skeleton tcl-proc
  "A simple tcl proc skeleton"
  "Enter new proc name: "
  \n
  "#\n#\n#\n"
  "proc  " str " {  } {"
  \n
  _
  \n
  "} # end " str
)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-12-30  2:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-27  1:31 Skeleton & Abbrev Tennis Smith
2002-12-27 20:19 ` Kai Großjohann
2002-12-29 16:06   ` Tennis Smith
2002-12-29 16:55     ` Kai Großjohann
2002-12-30  2:33       ` Tennis Smith

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).