snippet for doxygen

653 views
Skip to first unread message

boissonnfive

unread,
Nov 27, 2008, 2:59:48 PM11/27/08
to smart-snippet and YASnippet
hi everbody!

I try to write a snippet for doxygen:

#name : /** ...
*/
# --
/**
* @brief ${description}
*
* @param ${nom} : ${definition}
* @return ${retour}
*/
$0

That doesn't work. I mean, when i type in the fields (description for
instance), the field is not overwritten, my writting is appended to
the field (=> xxxxxxxdescription).

I found a workaround:
#name : /** ...
*/
#
--
$0\/**
* @brief ${description}
*
* @param ${nom} : ${definition}
* @return ${retour}
*/
I have to delete the backslash at the end. It's not cool.
Do you know why there is such a behaviour? (comment relative?)

Thanks.
Bruno.

Zhang Chiyuan

unread,
Dec 1, 2008, 9:23:08 AM12/1/08
to smart-...@googlegroups.com
Hi, It works for me perfectly. Make sure you are using a some what new
version of Emacs and have font-lock enabled.
--
pluskid

Bruno Boissonnet

unread,
Dec 1, 2008, 10:10:04 AM12/1/08
to smart-...@googlegroups.com
Hi Zhang,

thank you for your answer and thank you for your great job.

I've definitely moved from Terminal to Aquamacs (I'm on mac os x)
where I don't have this "phenomen"
and I have some super feature like switching meta key from ESC to Alt
with respect to my french keys (|,~,{, etc...) that need Alt key.

BTW,I use yasnippet with auto-insert to create template for my c files.
It's a little bit tricky but if anyone care...

.emacs:
(auto-insert-mode 1)
(add-to-list 'load-path "~/emacs/auto-insert") ;emacs va charger
les .el contenus dans ~/emacs
(load-library "c-header")
(setq auto-insert-alist
(append '((("\\.\\([Cc]\\|cc\\|cpp\\)\\'" . "C / C++
program") . insert-c-header-yasnippet))
auto-insert-alist))


~/emacs/auto-insert/c-header.el:
(defun insert-c-header-yasnippet ()
"Insère l'entête d'un fichier de type c (c/c++/...)"
(interactive)
(insert "c-header")
(yas/expand)
)

~/emacs/snippets/textmode/cc-mode/c-header:
#name : /* ... ... */
# --
/*
* `(file-name-nondirectory (file-name-sans-extension (buffer-file-
name)))`.c ${description}
*
* Bruno Boissonnet `(format-time-string "%A %d %b %Y")`
*
*
* ${remarques}
*/

#include "`(file-name-nondirectory (file-name-sans-extension (buffer-
file-name)))`.h"

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
$0
return EXIT_SUCCESS;
}


/* End of file */

Le 1 déc. 08 à 15:23, Zhang Chiyuan a écrit :
Reply all
Reply to author
Forward
0 new messages