emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Indentation bug in html-mode


From: Lennart Borgman (gmail)
Subject: Re: Indentation bug in html-mode
Date: Wed, 25 Apr 2007 12:34:48 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070326 Thunderbird/2.0.0.0 Mnenhy/0.7.5.666

Stefan Monnier wrote:
The attached file is valid XHTML 1.1 but indents badly because of the < inte
<?php ... ?> part. I paste it here for simplicity too:

Hmm... does the patch below fix it for you?
If you put a "<?" inside your PHP code, it seems it would still be valid
XML, but indentation will probably get confused.

It fixes the last two lines (</body> and </html>), but not the </div> line.


        Stefan


--- orig/lisp/textmodes/sgml-mode.el
+++ mod/lisp/textmodes/sgml-mode.el
@@ -1183,6 +1183,15 @@
        ((sgml-looking-back-at "]]")  ; cdata
        (setq tag-type 'cdata
              tag-start (re-search-backward "<!\\[[A-Z]+\\[" nil t)))
+       ((sgml-looking-back-at "?")      ; XML processing-instruction
+        (setq tag-type 'pi
+              ;; IIUC: SGML processing instructions take the form <?foo ...>
+              ;; i.e. a "normal" tag, handled below.  In XML this is changed
+              ;; to <?foo ... ?> where "..." can contain < and > and even <?
+              ;; but not ?>.  This means that when parsing backward, there's
+              ;; no easy way to make sure that we find the real beginning of
+              ;; the PI.
+             tag-start (search-backward "<?" nil t)))
        (t
        (setq tag-start
              (with-syntax-table sgml-tag-syntax-table






reply via email to

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