summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Julian Squires <julian@cipht.net>2015-05-04 14:35:07 -0400
committerGravatar Julian Squires <julian@cipht.net>2015-05-04 14:35:07 -0400
commit5f9e9a73c820725b543ae012dac88b659880cfbf (patch)
tree4b947a4ecc52c869a353f816e13cd4a1f7efbfa5 /src
parente5aa4b8a9c693b390ca372eb21a0265b0a7dc9e6 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/elisp/urweb-mode.el10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/elisp/urweb-mode.el b/src/elisp/urweb-mode.el
index 2963434d..5eb36bc4 100644
--- a/src/elisp/urweb-mode.el
+++ b/src/elisp/urweb-mode.el
@@ -179,11 +179,11 @@ See doc for the variable `urweb-mode-info'."
(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 @@ See doc for the variable `urweb-mode-info'."
((= xml-tag 4)
(incf depth))
- ((equal ch ?-)
+ ((equal ch "-")
(if (looking-at "->")
(setq finished (= depth 0))))
((and (= depth 0)
(not (looking-at "<xml")) ;; ignore <xml/>
- (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)