diff options
author | Michal Nazarewicz <mina86@mina86.com> | 2014-11-16 17:38:15 +0100 |
---|---|---|
committer | Michal Nazarewicz <mina86@mina86.com> | 2014-11-18 00:46:50 +0100 |
commit | b8104090075eb28dd6680cc9f8b0a49674ca369a (patch) | |
tree | 6a4cb090a7ac881eb370edc8ac53938f3d291329 /lisp/nxml | |
parent | 07556b0299b33b52cf352581bfdd6554819eea30 (diff) | |
download | emacs-b8104090075eb28dd6680cc9f8b0a49674ca369a.tar.gz |
tildify.el: introduce a `tildify-space-string' variable
* textmodes/tildify.el (tildify-space-string): New variable for
specifying representation of a hard space -- a no-break space by
default. Being a buffer-local variable it is much easier to
handle than `tildify-string-alist' that has been used so far. It
also works better with derived modes.
(tildify-string-alist): Mark as obsolete.
* textmodes/tex-mode.el (tex-common-initialization): Set
`tildify-space-string' variable in all variants of TeX mode since
`tildify-string-alist' is now empty by default.
* nxml/nxml-mode.el (nxml-mode): Ditto in `nxml-mode'. If
encoding supports it use no-break space instead of character
entity; this changes previous default which used a numeric
reference.
* textmodes/sgml-mode.el (sgml-mode): ditto in `sgml-mode'. If
encoding does not support no-break space, use numeric reference;
this changes previous default which used named entity (“ ”)
in HTML mode.
Diffstat (limited to 'lisp/nxml')
-rw-r--r-- | lisp/nxml/nxml-mode.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index 4859bbc7a77..47f806693df 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -449,6 +449,8 @@ reference.") (when rng-validate-mode (rng-validate-while-idle (current-buffer))))) +(defvar tildify-space-string) + ;;;###autoload (define-derived-mode nxml-mode text-mode "nXML" ;; We use C-c C-i instead of \\[nxml-balanced-close-start-tag-inline] @@ -505,6 +507,14 @@ be treated as a single markup item, set the variable 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) " ") + " " " ")) (set (make-local-variable 'mode-line-process) '((nxml-degraded "/degraded"))) ;; We'll determine the fill prefix ourselves (make-local-variable 'adaptive-fill-mode) |