summaryrefslogtreecommitdiff
path: root/lisp/nxml
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2016-01-15 16:59:21 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2016-01-15 16:59:21 -0500
commit05988c0d527de99d54266cc3ef0688899761ba26 (patch)
tree4ba92926a612c4bbee489bc6a7989ebbbf87b9f5 /lisp/nxml
parent984a14904658da42ca9dea50a811a901ddc56e60 (diff)
downloademacs-05988c0d527de99d54266cc3ef0688899761ba26.tar.gz
* xmltok.el: Mark the "sole --" rather than the comment opener
* lisp/nxml/xmltok.el (xmltok-scan-after-comment-open): Put the error marker on the "sole --" rather than on the comment opener.
Diffstat (limited to 'lisp/nxml')
-rw-r--r--lisp/nxml/xmltok.el27
1 files changed, 9 insertions, 18 deletions
diff --git a/lisp/nxml/xmltok.el b/lisp/nxml/xmltok.el
index 8fc66c99a45..93d47c195c0 100644
--- a/lisp/nxml/xmltok.el
+++ b/lisp/nxml/xmltok.el
@@ -262,11 +262,10 @@ and VALUE-END, otherwise a STRING giving the value."
(vector message start end))
(defun xmltok-add-error (message &optional start end)
- (setq xmltok-errors
- (cons (xmltok-make-error message
- (or start xmltok-start)
- (or end (point)))
- xmltok-errors)))
+ (push (xmltok-make-error message
+ (or start xmltok-start)
+ (or end (point)))
+ xmltok-errors))
(defun xmltok-forward ()
(setq xmltok-start (point))
@@ -739,19 +738,11 @@ Return the type of the token."
(setq xmltok-type 'processing-instruction))
(defun xmltok-scan-after-comment-open ()
- (let ((found-- (search-forward "--" nil 'move)))
- (setq xmltok-type
- (cond ((or (eq (char-after) ?>) (not found--))
- (goto-char (1+ (point)))
- 'comment)
- (t
- ;; just include the <!-- in the token
- (goto-char (+ xmltok-start 4))
- ;; Need do this after the goto-char because
- ;; marked error should just apply to <!--
- (xmltok-add-error "First following `--' not followed by `>'")
- (goto-char (point-max))
- 'comment)))))
+ (let (found--)
+ (while (and (setq found-- (re-search-forward "--\\(>\\)?" nil 'move))
+ (not (match-end 1)))
+ (xmltok-add-error "`--' not followed by `>'" (match-beginning 0)))
+ (setq xmltok-type 'comment)))
(defun xmltok-scan-attributes ()
(let ((recovering nil)