emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 05988c0: * xmltok.el: Mark the "sole --" rather tha


From: Stefan Monnier
Subject: [Emacs-diffs] master 05988c0: * xmltok.el: Mark the "sole --" rather than the comment opener
Date: Fri, 15 Jan 2016 21:59:25 +0000

branch: master
commit 05988c0d527de99d54266cc3ef0688899761ba26
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * 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.
---
 lisp/nxml/xmltok.el |   27 +++++++++------------------
 1 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/lisp/nxml/xmltok.el b/lisp/nxml/xmltok.el
index 8fc66c9..93d47c1 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]