Emacs/psgml problem

Dave Pawson davep at dpawson.co.uk
Sun Aug 15 16:20:34 UTC 2004


On Sun, 2004-08-15 at 16:55, Paul W. Frields wrote:
> I'm hoping someone here has a quick solution. I'm working on a document
> and my tags are giving me a problem under psgml. At a certain point in
> my document, when I use a <filename> tag, slashes in the file name
> content (not inside the tag marker) are being interpreted as ending tags
> for the content outside "filename." So when I type:
> 
>   <filename>/etc/fstab</filename>
> 
> the first slash is being seen as </para>, and the second as </sect1>.
Something is wrong Paul.
The electric close should operate on </ not just on /
Unless some clever person has added even more brevity?
I.e. you shouldn't get tag closure until the </

This is code to do it

(defun sgml-slash-check () "For psgml-mode, if you type `/' after `<',
insert the appropriate end tag, if there is an open element." 
(interactive) 
(if (= (char-before) 60) 
;; Slash after <, let's end the current open element if we can 
(progn 
(sgml-parse-to-here) 
(cond 
((eq sgml-current-tree sgml-top-tree) 
(insert "/")) 
((not (sgml-final-p sgml-current-state)) 
(insert "/")) 
(t (progn 
(delete-backward-char 1) 
(insert (sgml-end-tag-of sgml-current-tree)))))) 
(insert "/")))


(add-hook 'xml-mode-hook 
(lambda () (define-key xml-mode-map "/" `sgml-slash-check))) 


Its a tortuous path to chase through emacs site-lisp and all
included .el files, but somewhere there should be similar code
to do this. I think its a part of psgml, but the code above
is for xsl-mode, so may be different.

psgml-edit.el is the file it's normally found it.

No idea of the 'standard' rh setup.



-- 
Regards DaveP.
XSLT&Docbook  FAQ
http://www.dpawson.co.uk/xsl






More information about the fedora-docs-list mailing list