Re: Using sgml-insert-element
Lennart Staflin <[email protected]> Thu, 14 Aug 2003 11:06:49 +0200
| Newsgroups | gmane.emacs.psgml.user |
|---|---|
| Message-ID | <[email protected]> |
On onsdag, aug 13, 2003, at 11:43 Europe/Stockholm, David Chadd wrote:
> If an xml element 'foo' has a required attribute 'bar', the function
> sgml-insert-element will ask for the value of this attribute at
> run-time. But I want to be able to do something like this inside a
> defun:
>
> (setq bar-value "blort")
> (sgml-insert-element "foo")
> (sgml-insert-attribute "bar" bar-value)
>
> to produce <foo bar="blort">
>
> Of course, this simply pauses with the minibuffer prompt for the
> value, which rather misses the point of it! Is there a psgml variable
> I can temporarily set (perhaps inside a 'let' routine) that will stop
> this happening?
Yes, the variable sgml-new-attribute-list-function. The variable should
contain a function of one argument that returns the list of attributes.
This function is called by sgml-insert-element with the element as
argument. Default value is sgml-default-asl, this is the function that
asks for the values of required attributes. You could supply a dummy
function (of one argument) that returns nil.
Alternatively the function could return
(list (sgml-make-attspec "bar" "blort") )
//Lennart
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01