help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using passing the tempo-template user input to my function?


From: Kevin Rodgers
Subject: Re: Using passing the tempo-template user input to my function?
Date: Tue, 26 Oct 2004 09:49:52 -0600
User-agent: Mozilla Thunderbird 0.8 (X11/20040916)

Hattuari wrote:
> I've tried all the ways I can come up with to pass the string returned from
> querying the user to my own function.  I know the string is there, I can
> paste it into the text at the point where I'm trying to paste a modified
> version.
>
> This is an example of code that pastes the original user text:
>
> (tempo-define-template
>  "array"
>  '("typedef array<"
>    (P "Data type: " data-type)
>    ","
>    (P "Number of components: 1 to 4 " data-order)
>    "> Array" (s data-type)))
> ;;

,----[ C-h f tempo-define-template RET ]
| tempo-define-template is a compiled Lisp function in `tempo'.
| (tempo-define-template NAME ELEMENTS &optional TAG DOCUMENTATION TAGLIST)
|
| Define a template.
| This function creates a template variable `tempo-template-NAME' and an
| interactive function `tempo-template-NAME' that inserts the template
| at the point.  The created function is returned.
...
| The elements in ELEMENTS can be of several types:
...
|  - The symbol 'p. This position is saved in `tempo-marks'.
...
|  - (p PROMPT <NAME> <NOINSERT>) If `tempo-interactive' is non-nil, the
|    user is prompted in the minbuffer with PROMPT for a string to be
|    inserted. If the optional parameter NAME is non-nil, the text is
|    saved for later insertion with the `s' tag. If there already is
|    something saved under NAME that value is used instead and no
|    prompting is made. If NOINSERT is provided and non-nil, nothing is
|    inserted, but text is still saved when a NAME is provided. For
|    clarity, the symbol 'noinsert should be used as argument.
|  - (P PROMPT <NAME> <NOINSERT>) Works just like the previous tag, but
|    forces tempo-interactive to be true.
...
|  - (s NAME) Inserts text previously read with the (p ..) construct.
|    Finds the insertion saved under NAME and inserts it. Acts like 'p
|    if tempo-interactive is nil.
...

If tempo-interactive is nil, perhaps you need to do something like

(let ((tempo-interactive t))
  (tempo-define-template ...))

which would also allow you to use (p ...) instead of (P ...) in your template.

--
Kevin Rodgers


reply via email to

[Prev in Thread] Current Thread [Next in Thread]