[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [h-e-w] Template creation
From: |
Jerome BESNARD |
Subject: |
Re: [h-e-w] Template creation |
Date: |
18 Feb 2002 10:44:25 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 |
I think you should use the (P ....) construct from the tempo package, with
the (s ....) if you need to reuse the placeholder.
This will make a prompt for the user.
Or if you need something more complex, you can always make some lisp code...
For example (stolen from matlab.el...)
(tempo-define-template
"matlab-function"
'("function "
(P "output argument(s): " output t)
;; Insert brackets only if there is more than one output argument
(if (string-match "," (tempo-lookup-named 'output))
'(l "[" (s output) "]")
'(l (s output)))
;; Insert equal sign only if there is output argument(s)
(if (= 0 (length (tempo-lookup-named 'output))) nil
" = ")
;; The name of a function, as defined in the first line, should
;; be the same as the name of the file without .m extension
(if (= 1 (count-lines 1 (point)))
(tempo-save-named
'fname
(file-name-nondirectory (file-name-sans-extension
(buffer-file-name))))
'(l (P "function name: " fname t)))
(tempo-lookup-named 'fname)
"(" (P "input argument(s): ") ")" n
"% " (upcase (tempo-lookup-named 'fname)) " - " (P "H1 line: ") n
"% " p n)
"function"
"Insert a Matlab function statement"
'matlab-tempo-tags
)
Hope this helps.
--
Jerome BESNARD - Tél : (33) 1 56 43 18 36
------------------------------
Miriad Technologies - 8, avenue Hoche 75008 Paris
Tél : (33) 1 56 43 18 00 - Fax : (33) 1 56 43 18 28
www.miriadtech.com