# HG changeset patch # User Julian Squires # Date 1430764507 14400 # Node ID 3288e3c9948bb93441325f0ae4cdb7874e634266 # Parent 53f91b67006c2e3a7db358e4929c1856380277b1 Fix XML indentation in Emacs mode The return value of MATCH-STRING is a string. At least on Emacs 25, the comparisons between string and character with EQUAL could never succeed, and so the cases for matching braces were never triggered. GET-TEXT-PROPERTY may return a list rather than an atom (for example, on long lines with whitespace-mode turned on), and this broke the heuristic of looking for the tag face in previous text. diff -r 53f91b67006c -r 3288e3c9948b src/elisp/urweb-mode.el --- a/src/elisp/urweb-mode.el Tue May 05 14:03:06 2015 -0400 +++ b/src/elisp/urweb-mode.el Mon May 04 14:35:07 2015 -0400 @@ -179,11 +179,11 @@ (let ((xml-tag (length (or (match-string 3) ""))) (ch (match-string 2))) (cond - ((equal ch ?\{) + ((equal ch "{") (if (> depth 0) (decf depth) (setq finished t))) - ((equal ch ?\}) + ((equal ch "}") (incf depth)) ((= xml-tag 3) (if (> depth 0) @@ -194,14 +194,14 @@ ((= xml-tag 4) (incf depth)) - ((equal ch ?-) + ((equal ch "-") (if (looking-at "->") (setq finished (= depth 0)))) ((and (= depth 0) (not (looking-at " - (eq font-lock-tag-face - (get-text-property (point) 'face))) + (let ((face (get-text-property (point) 'face))) + (funcall (if (listp face) #'member #'equal) 'font-lock-tag-face face))) ;; previous code was highlighted as tag, seems we are in xml (progn (setq answer t)