[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master ec0ddb5 2/3: Properly quote nested xml comments (Bu
From: |
Ivan Andrus |
Subject: |
[Emacs-diffs] master ec0ddb5 2/3: Properly quote nested xml comments (Bug#6267) (Bug#20001) |
Date: |
Wed, 23 Sep 2015 23:51:00 +0000 |
branch: master
commit ec0ddb5c7a27dd600a68940db762fc5c92550b08
Author: Ivan Andrus <address@hidden>
Commit: Ivan Andrus <address@hidden>
Properly quote nested xml comments (Bug#6267) (Bug#20001)
* nxml-mode.el (nxml-comment-quote-nested): New function
(nxml-mode): Set comment-quote-nested-function
---
lisp/nxml/nxml-mode.el | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index 6c5c85b..dc151a3 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -546,6 +546,8 @@ Many aspects this mode can be customized using
(setq comment-end-skip "[ \t\r\n]*-->")
(make-local-variable 'comment-line-break-function)
(setq comment-line-break-function 'nxml-newline-and-indent)
+ (make-local-variable 'comment-quote-nested-function)
+ (setq comment-quote-nested-function 'nxml-comment-quote-nested)
(use-local-map nxml-mode-map)
(save-excursion
(save-restriction
@@ -1350,6 +1352,18 @@ of the inserted start-tag or nil if none was inserted."
start-tag-indent)))))
inserted-start-tag-pos))
+(defun nxml-comment-quote-nested (cs ce unp)
+ "Quote nested comments in buffer.
+See `comment-quote-nested-function' for more information.")
+ (goto-char (point-min))
+ (save-match-data
+ (while (re-search-forward "-[\\]*-" nil t)
+ (goto-char (match-beginning 0))
+ (forward-char 1)
+ (if unp
+ (delete-char 1)
+ (insert "\\")))))
+
;;; Indentation
(defun nxml-indent-line ()