unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Insert function descriptor
@ 2006-08-04 11:24 Kal
  2006-08-06  9:21 ` wenbinye
  0 siblings, 1 reply; 3+ messages in thread
From: Kal @ 2006-08-04 11:24 UTC (permalink / raw)


Hello,

When I write a function in C, I write it like this :

/* ---------------------------------------------------------------------
   accind_ouvriraux()
   ---------------------------------------------------------------------
   Build file name and call fopen()
   ---------------------------------------------------------------------
   I : Char pointer
   I : Char pointer
   O : File pointer
   --------------------------------------------------------------------- */
static FILE *
accind_ouvriraux(char *prefixe, char *suffixe);

My wish is to get the header description automatically. One way to do it
is mapping a key sentence (expl : C-F1) to a lisp function which ask the
name for the function :

Name of the function : toto

And build after that the header :

/* ---------------------------------------------------------------------
   toto()
   ---------------------------------------------------------------------
   Description :
   ---------------------------------------------------------------------
   I :
   O :
   --------------------------------------------------------------------- */

Is it possible ?

-- 
Kal

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

* Re: Insert function descriptor
  2006-08-04 11:24 Insert function descriptor Kal
@ 2006-08-06  9:21 ` wenbinye
  2006-08-06 16:02   ` Kal
  0 siblings, 1 reply; 3+ messages in thread
From: wenbinye @ 2006-08-06  9:21 UTC (permalink / raw)


maybe you can use skeleton to do it:

(define-skeleton skeleton-c-mode-func-desc
 "" nil
 > "/*
---------------------------------------------------------------------\n"
 > (skeleton-read "Function name: ") "()\n"
 >
"---------------------------------------------------------------------\n"
 > "Description :\n"
 >
"---------------------------------------------------------------------\n"
 > "I :\n"
 > "O :\n"
 >
"---------------------------------------------------------------------
*/\n")
(define-abbrev-table 'c-mode-abbrev-table '(
    ("funcx" "" skeleton-c-mode-func-desc 1)
    ))

Kal wrote:
> Hello,
>
> When I write a function in C, I write it like this :
>
> /* ---------------------------------------------------------------------
>    accind_ouvriraux()
>    ---------------------------------------------------------------------
>    Build file name and call fopen()
>    ---------------------------------------------------------------------
>    I : Char pointer
>    I : Char pointer
>    O : File pointer
>    --------------------------------------------------------------------- */
> static FILE *
> accind_ouvriraux(char *prefixe, char *suffixe);
>
> My wish is to get the header description automatically. One way to do it
> is mapping a key sentence (expl : C-F1) to a lisp function which ask the
> name for the function :
>
> Name of the function : toto
>
> And build after that the header :
>
> /* ---------------------------------------------------------------------
>    toto()
>    ---------------------------------------------------------------------
>    Description :
>    ---------------------------------------------------------------------
>    I :
>    O :
>    --------------------------------------------------------------------- */
> 
> Is it possible ?
> 
> -- 
> Kal

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

* Re: Insert function descriptor
  2006-08-06  9:21 ` wenbinye
@ 2006-08-06 16:02   ` Kal
  0 siblings, 0 replies; 3+ messages in thread
From: Kal @ 2006-08-06 16:02 UTC (permalink / raw)


wenbinye@gmail.com a écrit :
> maybe you can use skeleton to do it:
> 
> (define-skeleton skeleton-c-mode-func-desc
>  "" nil
>  > "/*
> ---------------------------------------------------------------------\n"
>  > (skeleton-read "Function name: ") "()\n"
>  >
> "---------------------------------------------------------------------\n"
>  > "Description :\n"
>  >
> "---------------------------------------------------------------------\n"
>  > "I :\n"
>  > "O :\n"
>  >
> "---------------------------------------------------------------------
> */\n")
> (define-abbrev-table 'c-mode-abbrev-table '(
>     ("funcx" "" skeleton-c-mode-func-desc 1)
>     ))
> 

Thank you, it works like a charm. At the beginning, i've tried
msf-abbrev but it need emacs 22, and I prefer to use a stable version.

Regards,

-- 
Kal

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

end of thread, other threads:[~2006-08-06 16:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-04 11:24 Insert function descriptor Kal
2006-08-06  9:21 ` wenbinye
2006-08-06 16:02   ` Kal

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