Subject: bug#946: 23.0.60; html-mode regression ('' within a table)

From: martin rudalics <[email-masked]>
Date: Thu, 18 Sep 2008 10:20:45 +0200

> 1. Create the following 3 line file /tmp/x.html
 >
 > <table>
 >   <tr><td>'9'</td></tr>
 > </table>
 >
 > 2. invoke emacs -Q /tmp/x.html
 >
 > 3. C-x h   to mark the buffer
 >
 > 4. C-M-\   to indent the buffer
 >
 > 5. The indentation is not changed (correct), but the message
 >    Unclosed tag <>
 >    is generated (wrong).
 >
 > 6. This does not occur with emacs 22.2 and does not occur if
 >    the three characters '9' are replaced with 9 or '9 but does occur if
 >    they are replaced with 9'

This happens because `backward-sexp' calls `backward-prefix-chars' which
skips the "'".  Could you please try the attached patch.

Thank you, martin
*** textmodes/sgml-mode.el.~1.136.~	2008-07-05 06:26:11.000000000 +0200
--- textmodes/sgml-mode.el	2008-09-18 10:07:18.000000000 +0200
***************
*** 784,790 ****
                    (with-syntax-table sgml-tag-syntax-table
                      (up-list -1)
                      (when (sgml-skip-tag-forward 1)
!                       (backward-sexp 1)
                        (forward-char 2)
                        t))))
                 (clones (get-char-property (point) 'text-clones)))
--- 784,790 ----
                    (with-syntax-table sgml-tag-syntax-table
                      (up-list -1)
                      (when (sgml-skip-tag-forward 1)
! 		      (goto-char (or (scan-sexps (point) -1) (point-min)))
                        (forward-char 2)
                        t))))
                 (clones (get-char-property (point) 'text-clones)))
***************
*** 1223,1229 ****
                  (with-syntax-table sgml-tag-syntax-table
                    (goto-char tag-end)
                    (condition-case nil
!                       (backward-sexp)
                      (scan-error
                       ;; This > isn't really the end of a tag. Skip it.
                       (goto-char (1- tag-end))
--- 1223,1229 ----
                  (with-syntax-table sgml-tag-syntax-table
                    (goto-char tag-end)
                    (condition-case nil
! 		      (goto-char (or (scan-sexps (point) -1) (point-min)))
                      (scan-error
                       ;; This > isn't really the end of a tag. Skip it.
                       (goto-char (1- tag-end))