Re: PSGML conflicts with sgml-mode (CVS Emacs)
"D. D. Brierton" <[email protected]> Thu, 07 Apr 2005 14:01:46 +0100
| Newsgroups | gmane.emacs.psgml.user |
|---|---|
| Organization | DZR Web Development |
| Message-ID | <[email protected]> |
On Thu, 2005-04-07 at 12:41 +0200, Lennart Staflin wrote:
> If you are using psgml for sgml and xml (with autoloads), it would seem
> that html-mode is the major problem. One solution (workaround really)
> is to replace html-mode with sgml-mode in auto-mode-alist. Another
> solution is to make a simple html-mode that uses sgml-mode.
>
> I use something like:
>
> (defun html-mode ()
> (interactive)
> (sgml-mode)
> (make-local-variable 'sgml-default-doctype-name)
> (setq sgml-default-doctype-name "HTML"
> sgml-always-quote-attributes t
> sgml-indent-step 2
> sgml-indent-data t
> sgml-minimize-attributes nil
> sgml-omittag t
> sgml-shortag t ))
I already use something very similar to what you have here. I'm no lisp
guru, so I can't see what it is that is different in my setup which
means that I still get the conflict with sgml-mode for html. I think
these ae the relevant parts of my (quite complicated) psgml setup:
(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t )
(autoload 'xml-mode "psgml" "Major mode to edit XML files." t)
(setq auto-mode-alist
(append
(list
'("\\.sgm$" . sgml-mode)
'("\\.sgml$" . sgml-mode)
'("\\.xml$" . xml-mode)
)
auto-mode-alist))
(define-derived-mode xml-html-mode xml-mode "XHTML"
"This version of html mode is just a wrapper around xml mode."
(make-local-variable 'sgml-declaration)
(make-local-variable 'sgml-default-doctype-name)
(setq
sgml-default-doctype-name "html"
sgml-declaration "/usr/share/sgml/xml.dcl"
sgml-always-quote-attributes t
sgml-indent-step 2
sgml-indent-data t
sgml-minimize-attributes nil
sgml-omittag nil
sgml-shorttag nil
)
)
(define-derived-mode sgml-html-mode sgml-mode "HTML"
"This version of html mode is just a wrapper around sgml mode."
(make-local-variable 'sgml-declaration)
(make-local-variable 'sgml-default-doctype-name)
(setq
sgml-default-doctype-name "html"
sgml-declaration "~/lib/DTD/html401/HTML4.decl"
sgml-always-quote-attributes t
sgml-indent-step 2
sgml-indent-data t
sgml-minimize-attributes nil
sgml-omittag nil
sgml-shorttag nil
)
)
(add-to-list 'auto-mode-alist '("\\.inc\\'" . sgml-html-mode))
(add-to-list 'auto-mode-alist '("\\.php[34]?\\'" . sgml-html-mode))
(add-to-list 'auto-mode-alist '("\\.[sj]?html?\\'" . sgml-html-mode))
(add-hook 'sgml-html-mode-hook 'guess-xhtml-hook t)
(defun guess-xhtml-hook ()
"Guess whether the current buffer is XHTML."
(when
(save-excursion
(search-forward-regexp "<[?]xml\\|//W3C//DTD XHTML" 80 t))
(xml-html-mode)
))
Perhaps the problem is that I'm not defining a new mode called "html-
mode", but instead two modes called "sgml-html-mode" and "xml-html-
mode", and so "html-mode" from sgml-mode.el is somehow not being
overridden for HTML?
Full details of my psgml setup are here:
http://www.dzr-web.com/people/darren/projects/emacs-webdev/
Thanks for the help, and thanks for PSGML!
Best, Darren
--
=====================================================================
D. D. Brierton [email protected] www.dzr-web.com
Trying is the first step towards failure (Homer Simpson)
=====================================================================
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click