aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Andrus2015-09-08 16:38:13 -0600
committerIvan Andrus2015-09-23 17:48:42 -0600
commitec0ddb5c7a27dd600a68940db762fc5c92550b08 (patch)
tree564bf476861d66efbcb52ade6d44a69f807684f7
parent04ef947705c1b4c1742f539c0299b1f3665ca504 (diff)
downloademacs-ec0ddb5c7a27dd600a68940db762fc5c92550b08.tar.gz
emacs-ec0ddb5c7a27dd600a68940db762fc5c92550b08.zip
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
-rw-r--r--lisp/nxml/nxml-mode.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index 6c5c85b2fcc..dc151a3c650 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
546 (setq comment-end-skip "[ \t\r\n]*-->") 546 (setq comment-end-skip "[ \t\r\n]*-->")
547 (make-local-variable 'comment-line-break-function) 547 (make-local-variable 'comment-line-break-function)
548 (setq comment-line-break-function 'nxml-newline-and-indent) 548 (setq comment-line-break-function 'nxml-newline-and-indent)
549 (make-local-variable 'comment-quote-nested-function)
550 (setq comment-quote-nested-function 'nxml-comment-quote-nested)
549 (use-local-map nxml-mode-map) 551 (use-local-map nxml-mode-map)
550 (save-excursion 552 (save-excursion
551 (save-restriction 553 (save-restriction
@@ -1350,6 +1352,18 @@ of the inserted start-tag or nil if none was inserted."
1350 start-tag-indent))))) 1352 start-tag-indent)))))
1351 inserted-start-tag-pos)) 1353 inserted-start-tag-pos))
1352 1354
1355(defun nxml-comment-quote-nested (cs ce unp)
1356 "Quote nested comments in buffer.
1357See `comment-quote-nested-function' for more information.")
1358 (goto-char (point-min))
1359 (save-match-data
1360 (while (re-search-forward "-[\\]*-" nil t)
1361 (goto-char (match-beginning 0))
1362 (forward-char 1)
1363 (if unp
1364 (delete-char 1)
1365 (insert "\\")))))
1366
1353;;; Indentation 1367;;; Indentation
1354 1368
1355(defun nxml-indent-line () 1369(defun nxml-indent-line ()