From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "D. D. Brierton" Newsgroups: gmane.emacs.help Subject: Suggestions? Better filetype sniffing -- XHTML vs. HTML Date: Tue, 24 Feb 2004 14:56:38 +0000 Organization: DZR Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1077634960 23625 80.91.224.253 (24 Feb 2004 15:02:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2004 15:02:40 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 24 16:02:15 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Ave4c-0008Ee-00 for ; Tue, 24 Feb 2004 16:02:14 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1Ave4V-0007Kc-Ie for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Feb 2004 10:02:07 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!t-online.de!npeer.de.kpn-eurorings.net!landlord!stones.force9.net.POSTED!not-for-mail User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Original-Newsgroups: gnu.emacs.help Original-Lines: 81 Original-NNTP-Posting-Host: 212.159.101.92 Original-X-Complaints-To: abuse@plus.net.uk Original-X-Trace: stones.force9.net 1077634497 212.159.101.92 (Tue, 24 Feb 2004 14:54:57 GMT) Original-NNTP-Posting-Date: Tue, 24 Feb 2004 14:54:57 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:121187 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:17138 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:17138 I'd like to be able to have emacs autodetect whether a file is an HTML file or an XHTML file. Standardly, file extension is not enough for this as HTML and XHTML files tend to have the same file extensions. I have to edit a lot of files created by other people, and they are often hopelessly invalid, so I have no hope of perfectly differentiating XHTML from HTML. However, there are some good clues to go on: If a file ends in one of the following: \.inc$ \.php[34]?$ \.[sjp]?html?$ Then (in my case) it is *either* HTML *or* XHTML. If a file with one of the above extensions has very near the beginning one or both of: Newsgroups: gmane.emacs.help Subject: Re: Suggestions? Better filetype sniffing -- XHTML vs. HTML Date: 24 Feb 2004 08:47:18 -0800 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <7i8yisfmqx.fsf@neoscale.com> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1077642121 11008 80.91.224.253 (24 Feb 2004 17:02:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2004 17:02:01 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 24 18:01:48 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AvfwJ-0002dT-00 for ; Tue, 24 Feb 2004 18:01:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1AvfvV-0001L9-75 for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Feb 2004 12:00:57 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!12.24.46.85!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 91 Original-NNTP-Posting-Host: 12.24.46.85 Original-X-Trace: news.uni-berlin.de 1077641239 52653319 I 12.24.46.85 ([151019]) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-Xref: shelby.stanford.edu gnu.emacs.help:121196 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:17148 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:17148 (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 )) -kin "D. D. Brierton" writes: > I'd like to be able to have emacs autodetect whether a file is an HTML > file or an XHTML file. Standardly, file extension is not enough for this > as HTML and XHTML files tend to have the same file extensions. I have to > edit a lot of files created by other people, and they are often hopelessly > invalid, so I have no hope of perfectly differentiating XHTML from HTML. > However, there are some good clues to go on: > > If a file ends in one of the following: > > \.inc$ > \.php[34]?$ > \.[sjp]?html?$ > > Then (in my case) it is *either* HTML *or* XHTML. > > If a file with one of the above extensions has very near the beginning one > or both of: > > > then it is XHTML. Otherwise it is probably just HTML. > > I know how to (add-to-list 'auto-mode-alist ... the file extensions, but I > don't know how to also check the first few lines of the file. Can anyone > offer any suggestions? > > Further details: > > I use psgml, and I define two derived modes: > > (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 > ) > ) > > I also have the following: > > ; What files to invoke the new html-mode for? > (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)) > > So that basically I end up in sgml-html-mode when I open an (X)HTML file, > and then if it is an XHTML file I have to manually M-x xml-html-mode. > > TIA, Darren > > -- > ====================================================================== > D. D. Brierton darren@dzr-web.com www.dzr-web.com > Trying is the first step towards failure (Homer Simpson) > ====================================================================== From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Suggestions? Better filetype sniffing -- XHTML vs. HTML Date: Tue, 24 Feb 2004 17:11:32 GMT Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1077643049 13724 80.91.224.253 (24 Feb 2004 17:17:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2004 17:17:29 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 24 18:17:12 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AvgBD-0004Cg-00 for ; Tue, 24 Feb 2004 18:17:12 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1AvgAy-0000w3-2f for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Feb 2004 12:16:56 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!snoopy.risq.qc.ca!charlie.risq.qc.ca!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 8 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-NNTP-Posting-Host: 132.204.24.84 Original-X-Complaints-To: abuse@umontreal.ca Original-X-Trace: charlie.risq.qc.ca 1077642692 132.204.24.84 (Tue, 24 Feb 2004 12:11:32 EST) Original-NNTP-Posting-Date: Tue, 24 Feb 2004 12:11:32 EST Original-Xref: shelby.stanford.edu gnu.emacs.help:121200 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:17151 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:17151 > I'd like to be able to have emacs autodetect whether a file is an HTML > file or an XHTML file. Standardly, file extension is not enough for this The sgml-mode.el in the CVS version of Emacs does that. You can browse the CVS repository from http://savannah.gnu.org/projects/emacs. Stefan From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "D. D. Brierton" Newsgroups: gmane.emacs.help Subject: Re: Suggestions? Better filetype sniffing -- XHTML vs. HTML Date: Tue, 24 Feb 2004 17:16:50 +0000 Organization: DZR Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <7i8yisfmqx.fsf@neoscale.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1077644067 16569 80.91.224.253 (24 Feb 2004 17:34:27 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2004 17:34:27 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 24 18:34:17 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AvgRk-0005lr-01 for ; Tue, 24 Feb 2004 18:34:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1AvgQn-0008Hy-FY for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Feb 2004 12:33:17 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!diablo.theplanet.net!zen.net.uk!demorgan.zen.co.uk!landlord!stones.force9.net.POSTED!not-for-mail User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-NNTP-Posting-Host: 212.159.101.92 Original-X-Complaints-To: abuse@plus.net.uk Original-X-Trace: stones.force9.net 1077642909 212.159.101.92 (Tue, 24 Feb 2004 17:15:09 GMT) Original-NNTP-Posting-Date: Tue, 24 Feb 2004 17:15:09 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:121201 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:17154 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:17154 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 Newsgroups: gmane.emacs.help Subject: Re: Suggestions? Better filetype sniffing -- XHTML vs. HTML Date: Tue, 24 Feb 2004 17:46:21 +0000 Organization: DZR Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <7i8yisfmqx.fsf@neoscale.com> <7iznb8e648.fsf@neoscale.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1077645911 21747 80.91.224.253 (24 Feb 2004 18:05:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2004 18:05:11 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 24 19:05:05 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AvgvZ-0000Lv-00 for ; Tue, 24 Feb 2004 19:05:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1AvgrY-0006MT-9J for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Feb 2004 13:00:56 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!t-online.de!skynet.be!landlord!wards.force9.net.POSTED!not-for-mail User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Original-Newsgroups: gnu.emacs.help Original-Lines: 17 Original-NNTP-Posting-Host: 212.159.101.92 Original-X-Complaints-To: abuse@plus.net.uk Original-X-Trace: wards.force9.net 1077644952 212.159.101.92 (Tue, 24 Feb 2004 17:49:12 GMT) Original-NNTP-Posting-Date: Tue, 24 Feb 2004 17:49:12 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:121207 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:17155 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:17155 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) ====================================================================== From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kin Cho Newsgroups: gmane.emacs.help Subject: Re: Suggestions? Better filetype sniffing -- XHTML vs. HTML Date: 24 Feb 2004 09:31:51 -0800 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <7iznb8e648.fsf@neoscale.com> References: <7i8yisfmqx.fsf@neoscale.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1077654097 10059 80.91.224.253 (24 Feb 2004 20:21:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2004 20:21:37 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 24 21:21:33 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Avj3c-0002tr-00 for ; Tue, 24 Feb 2004 21:21:32 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1Avggc-0004Hg-Pb for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Feb 2004 12:49:38 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!12.24.46.85!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 31 Original-NNTP-Posting-Host: 12.24.46.85 Original-X-Trace: news.uni-berlin.de 1077643912 52613412 I 12.24.46.85 ([151019]) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-Xref: shelby.stanford.edu gnu.emacs.help:121204 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:17166 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:17166 "D. D. Brierton" 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 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: slashdevslashnull@gmx.net Newsgroups: gmane.emacs.help Subject: Re: Suggestions? Better filetype sniffing -- XHTML vs. HTML Date: Fri, 27 May 2005 16:29:04 +0200 Message-ID: <87fyw891zj.fsf@matthi.local> References: <7i8yisfmqx.fsf@neoscale.com> <7iznb8e648.fsf@neoscale.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1117208808 26055 80.91.229.2 (27 May 2005 15:46:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 27 May 2005 15:46:48 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 27 17:46:46 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dbh1P-000398-AG for geh-help-gnu-emacs@m.gmane.org; Fri, 27 May 2005 17:45:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dbh5g-0005Tk-Mq for geh-help-gnu-emacs@m.gmane.org; Fri, 27 May 2005 11:49:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dbh1K-0003RX-Fs for help-gnu-emacs@gnu.org; Fri, 27 May 2005 11:45:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dbh1B-0003O6-QN for help-gnu-emacs@gnu.org; Fri, 27 May 2005 11:45:03 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dbh1A-0003LK-N2 for help-gnu-emacs@gnu.org; Fri, 27 May 2005 11:45:00 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1Dbgsc-0008Oh-4c for help-gnu-emacs@gnu.org; Fri, 27 May 2005 11:36:10 -0400 Original-Received: from root by ciao.gmane.org with local (Exim 4.43) id 1DbgnF-0000kH-6I for help-gnu-emacs@gnu.org; Fri, 27 May 2005 17:30:37 +0200 Original-Received: from port-212-202-198-76.dynamic.qsc.de ([212.202.198.76]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 May 2005 17:30:37 +0200 Original-Received: from slashdevslashnull by port-212-202-198-76.dynamic.qsc.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 May 2005 17:30:37 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 37 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: port-212-202-198-76.dynamic.qsc.de User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:CkI26bj8WEEaEFlkzQK9bjKaad0= X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:27020 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:27020 "D. D. Brierton" 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. From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.help Subject: Re: Suggestions? Better filetype sniffing -- XHTML vs. HTML Date: Sat, 28 May 2005 01:39:16 +0200 Organization: sometimes Message-ID: <7e64x48cij.fsf@ada2.unipv.it> References: <7i8yisfmqx.fsf@neoscale.com> <7iznb8e648.fsf@neoscale.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1117237285 11065 80.91.229.2 (27 May 2005 23:41:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 27 May 2005 23:41:25 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat May 28 01:41:17 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DboRb-0006U3-75 for geh-help-gnu-emacs@m.gmane.org; Sat, 28 May 2005 01:40:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DboVx-0004GU-Ig for geh-help-gnu-emacs@m.gmane.org; Fri, 27 May 2005 19:45:17 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news100.image.dk!feed.news.tiscali.de!uninett.no!uio.no!quimby.gnus.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 18 Original-NNTP-Posting-Host: ada2.unipv.it Original-X-Trace: quimby.gnus.org 1117237155 2327 193.204.44.145 (27 May 2005 23:39:15 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: Fri, 27 May 2005 23:39:15 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:gmwu8WohAC/ZXH4PUYtc12Kl09M= Original-Xref: shelby.stanford.edu gnu.emacs.help:131570 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:27029 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:27029 On Tue, 24 Feb 2004 09:31:51 -0800, Kin Cho wrote: > If you know C, 'xml-html-mode is like taking the > address of a function. that's a stretch! did anyone who: (a) did know C previously and (b) did NOT know emacs lisp previously and (c) learned something about emacs lisp eventually find this comparison to be helpful in going from (b) to (c)? i'd like to expand my repertoire of didactic methods, so if this does indeed work (contrary to my intuition), please let me know! it won't be the first time i've been wrong... thi From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: don provan Newsgroups: gmane.emacs.help Subject: Re: Suggestions? Better filetype sniffing -- XHTML vs. HTML Date: 30 May 2005 23:52:50 -0700 Message-ID: References: <7i8yisfmqx.fsf@neoscale.com> <7iznb8e648.fsf@neoscale.com> <7e64x48cij.fsf@ada2.unipv.it> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1117522777 31887 80.91.229.2 (31 May 2005 06:59:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 31 May 2005 06:59:37 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 31 08:59:36 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dd0hl-000599-Gq for geh-help-gnu-emacs@m.gmane.org; Tue, 31 May 2005 08:58:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dd0mn-0002q8-Ba for geh-help-gnu-emacs@m.gmane.org; Tue, 31 May 2005 03:03:37 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Tue, 31 May 2005 01:52:43 -0500 Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-Lines: 34 Original-NNTP-Posting-Host: 24.5.243.171 Original-X-Trace: sv3-jmTtw7DfuaZdDRW9b3pGHXDdJ39t4UmpCXbCjUrAyUNZKNVciqO+1E9wjRPvceGW8WeYb3oVbWlkiB0!MD3h2jTjOt4OIZhtVnOTkCmC+v2DGjiOZl5MJVCgFLWEaeDr Original-X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Original-Xref: shelby.stanford.edu gnu.emacs.help:131628 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:27087 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:27087 Thien-Thi Nguyen writes: > On Tue, 24 Feb 2004 09:31:51 -0800, Kin Cho wrote: > > > If you know C, 'xml-html-mode is like taking the > > address of a function. > > that's a stretch! > > did anyone who: > (a) did know C previously > and (b) did NOT know emacs lisp previously > and (c) learned something about emacs lisp eventually > find this comparison to be helpful in going from (b) to (c)? It's hard to remember back that far, but I think I probably found that comparison helpful way back when. I'm not sure why you think it's such a stretch. Sure, there are significant differences, but none-the-less, (setq f 'function) (funcall f) is how you accomplish in emacs the same feat as in C with f = function; /* implicitely takes the address of function */ (*f)(); I suppose not all C programmers are familiar with function pointers, yet you really aren't an emacs programmer until you're familiar with quoted function names, so it might be considered a stretch in the sense that some C programmers wouldn't have the concept to begin with. Is that what you meant? -don provan From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.help Subject: Re: Suggestions? Better filetype sniffing -- XHTML vs. HTML Date: Mon, 12 Sep 2005 09:59:54 +0200 Organization: sometimes Message-ID: <7e4q8qu35x.fsf@ada2.unipv.it> References: <7i8yisfmqx.fsf@neoscale.com> <7iznb8e648.fsf@neoscale.com> <7e64x48cij.fsf@ada2.unipv.it> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1126516729 9645 80.91.229.2 (12 Sep 2005 09:18:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 12 Sep 2005 09:18:49 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 12 11:18:41 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EEkRW-0004BP-Pd for geh-help-gnu-emacs@m.gmane.org; Mon, 12 Sep 2005 11:17:39 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EEkRV-0004Qk-Ts for geh-help-gnu-emacs@m.gmane.org; Mon, 12 Sep 2005 05:17:37 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!uio.no!quimby.gnus.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 34 Original-NNTP-Posting-Host: ada2.unipv.it Original-X-Trace: quimby.gnus.org 1126511905 8518 193.204.44.145 (12 Sep 2005 07:58:25 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: Mon, 12 Sep 2005 07:58:25 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:2/amNDq958Z2ccpsklm+S3Kqo1M= Original-Xref: shelby.stanford.edu gnu.emacs.help:133870 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:29421 Archived-At: don provan writes: > It's hard to remember back that far, but I think I probably found that > comparison helpful way back when. I'm not sure why you think it's such > a stretch. Sure, there are significant differences, but none-the-less, > > (setq f 'function) > (funcall f) > > is how you accomplish in emacs the same feat as in C with > > f = function; /* implicitely takes the address of function */ > (*f)(); > > I suppose not all C programmers are familiar with function pointers, > yet you really aren't an emacs programmer until you're familiar with > quoted function names, so it might be considered a stretch in the > sense that some C programmers wouldn't have the concept to begin with. > Is that what you meant? adopting analogies is a great way to learn, but i have been burned by adopting ones that i mistakenly took to be more insightful (general) than they actually were. in this case, i might have as a newbie (conjecture because i have forgotten the precise steps of my learning process, unfortunately), taken the above to also imply that: (setq f '(+ 1 2 3)) (funcall f) would also be "valid", which it is not. it certainly is valid when the quoted object is a function, i'm not arguing against that. i'm just pointing out how easily i confuse myself w/ a little imprecision. thi From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: don provan Newsgroups: gmane.emacs.help Subject: Re: Suggestions? Better filetype sniffing -- XHTML vs. HTML Date: Thu, 15 Sep 2005 09:25:50 -0700 Message-ID: References: <7i8yisfmqx.fsf@neoscale.com> <7iznb8e648.fsf@neoscale.com> <7e64x48cij.fsf@ada2.unipv.it> <7e4q8qu35x.fsf@ada2.unipv.it> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1126802023 4138 80.91.229.2 (15 Sep 2005 16:33:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 15 Sep 2005 16:33:43 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 15 18:33:39 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EFwcy-0003iA-JL for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Sep 2005 18:30:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFwcy-00058I-1C for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Sep 2005 12:30:24 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Thu, 15 Sep 2005 11:25:48 -0500 Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:qnLbrbSHbbgUBFoJvJ+t02mBNdw= Original-Lines: 28 Original-NNTP-Posting-Host: 24.5.236.116 Original-X-Trace: sv3-MmNJ31T6hI5NHzmP89Agl98ubESJPRWyx/zGdu08mPx7WRMaPbJZ306NlQEQPp4DQaAT2j3bBT1izYQ!n1nYQoeAt9oKnv4lBJPVcROXso6pX0HGHhigEN5Rto+ZrHJKh5DgmPJ0PdOSPxo= Original-X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Original-Xref: shelby.stanford.edu gnu.emacs.help:133910 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:29466 Archived-At: Thien-Thi Nguyen writes: > (setq f '(+ 1 2 3)) > (funcall f) > > would also be "valid", which it is not. I've kinda forgotten what we're talking about now, but I think the question was something about using concepts about function addressing learned from C as a way of explaining quoted function names when learning lisp. So you would only think the above is valid if you thought extern int func(int, int, int); int (*f)(int, int, int); f = func(1, 2, 3); /* or perhaps "&func(1, 2, 3)" */ (*f)(); was valid in C, which it is not. Quoting an expression is really quite a bit different than quoting a function name, so I don't really see any reason to worry about the two being confused. Granted, what is completely unexpected to a C programer is that (setq f '(+ 1 2 3)) (eval f) is valid and does do just what it looks like it does. -don