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

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

Re: Suggestions? Better filetype sniffing -- XHTML vs. HTML


From: slashdevslashnull
Subject: Re: Suggestions? Better filetype sniffing -- XHTML vs. HTML
Date: Fri, 27 May 2005 16:29:04 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux)

"D. D. Brierton" <darren@dzr-web.com> writes:

> On Tue, 24 Feb 2004 09:31:51 -0800, Kin Cho wrote:
>
>> Change 'xml-html-mode to (xml-html-mode).
>> 
>> If you know C, 'xml-html-mode is like taking the address of a
>> function.
>
> That did the trick. Thanks a lot!
>
> Best, Darren
>
> -- 
> ======================================================================
> D. D. Brierton            darren@dzr-web.com           www.dzr-web.com
>        Trying is the first step towards failure (Homer Simpson)
> ======================================================================

It still doesnt work for me. The hook prevents MMM-Mode from being
activated for html - files (non xhtml) for me. This may be due to
splitting your Emacs WebDev (thank you for that) across multiple files
or the MMM-Mode version i am using (0.4.8) or something else.

I guess its because MMM-Mode reruns the sgml-html-mode hooks while activating
which somehow fails for html files when point is not at the beginning of
the buffer which seems to be the case.

(defun guess-xhtml-hook ()
  "Guess whether the current buffer is XHTML."
  (when
      (save-excursion
        (goto-char 1)
        (search-forward-regexp "<[?]xml\\|//W3C//DTD XHTML" 80 t))
    (xml-html-mode)))

works for me.





reply via email to

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