From: Kin Cho <ignore-this-prefixkin@techie.com>
Subject: Re: Suggestions? Better filetype sniffing -- XHTML vs. HTML
Date: 24 Feb 2004 09:31:51 -0800 [thread overview]
Message-ID: <7iznb8e648.fsf@neoscale.com> (raw)
In-Reply-To: pan.2004.02.24.17.16.42.300919@dzr-web.com
"D. D. Brierton" <darren@dzr-web.com> writes:
> On Tue, 24 Feb 2004 08:47:18 -0800, Kin Cho wrote:
>
> > (add-hook 'find-file-hooks 'my-find-file-hooks t)
> >
> > (defun my-find-file-hooks ()
> > (when (save-excursion (search-forward-regexp "\?xml\\|XHTML" 80 t))
> > ;; do whatever you need to do
> > ))
>
> Thanks for this suggestion, Kin. Following on from your suggestion, I
> guess that rather than adding a hook to find-file-hooks, I guess I could
> add it to 'sgml-html-mode-hook instead, so .php or .html files etc
> initially open in sgml-html-mode, but then if a <?xml or //W3C//DTD XHTML
> string was found it would then switch into xml-html-mode. So I guess, that
> would go something like:
>
> (add-hook 'sgml-html-mode-hook 'check-for-xhtml-hook t)
>
> (defun check-for-xhtml-hook ()
> (when (save-excursion (search-forward-regexp "<[?]xml\\|//W3C//DTD XHTML" 80 t))
> 'xml-html-mode ;; looks like this line isn't right
> ))
Change 'xml-html-mode to (xml-html-mode).
If you know C, 'xml-html-mode is like taking the address of a
function.
-kin
next prev parent reply other threads:[~2004-02-24 17:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-24 14:56 Suggestions? Better filetype sniffing -- XHTML vs. HTML D. D. Brierton
2004-02-24 16:47 ` Kin Cho
2004-02-24 17:16 ` D. D. Brierton
2004-02-24 17:31 ` Kin Cho [this message]
2004-02-24 17:46 ` D. D. Brierton
2005-05-27 14:29 ` slashdevslashnull
[not found] ` <mailman.2088.1117208718.25862.help-gnu-emacs@gnu.org>
2005-05-27 23:39 ` Thien-Thi Nguyen
2005-05-31 6:52 ` don provan
2005-09-12 7:59 ` Thien-Thi Nguyen
2005-09-15 16:25 ` don provan
2004-02-24 17:11 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7iznb8e648.fsf@neoscale.com \
--to=ignore-this-prefixkin@techie.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).