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: Stefan Monnier
Subject: Re: Indentation bug in html-mode
Date: Tue, 24 Apr 2007 12:11:30 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux)

> 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.


        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]