;;; nxml-mode.el --- a new XML mode -*- lexical-binding:t -*-
-;; Copyright (C) 2003-2004, 2007-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2007-2015 Free Software Foundation, Inc.
;; Author: James Clark
;; Keywords: wp, hypermedia, languages, XML
(when rng-validate-mode
(rng-validate-while-idle (current-buffer)))))
+(defvar tildify-space-string)
+(defvar tildify-foreach-region-function)
+
;;;###autoload
(define-derived-mode nxml-mode text-mode "nXML"
;; We use C-c C-i instead of \\[nxml-balanced-close-start-tag-inline]
Many aspects this mode can be customized using
\\[customize-group] nxml RET."
;; (kill-all-local-variables)
+ ;; If encoding does not allow non-break space character, use reference.
+ ;; FIXME: This duplicates code from sgml-mode, perhaps derive from it?
+ ;; FIXME: Perhaps use if possible (e.g. XHTML)?
+ (setq-local tildify-space-string
+ (if (equal (decode-coding-string
+ (encode-coding-string " " buffer-file-coding-system)
+ buffer-file-coding-system) " ")
+ " " " "))
+ ;; FIXME: Use the fact that we're parsing the document already
+ ;; rather than using regex-based filtering.
+ (setq-local tildify-foreach-region-function
+ (apply-partially 'tildify-foreach-ignore-environments
+ '(("<! *--" . "-- *>") ("<" . ">"))))
(set (make-local-variable 'mode-line-process) '((nxml-degraded "/degraded")))
;; We'll determine the fill prefix ourselves
(make-local-variable 'adaptive-fill-mode)