aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/unicode-tokens.el
diff options
context:
space:
mode:
authorGravatar David Aspinall <da@inf.ed.ac.uk>2008-02-06 23:22:57 +0000
committerGravatar David Aspinall <da@inf.ed.ac.uk>2008-02-06 23:22:57 +0000
commit3157e0b18ba439ce51e3aae2242c026644c6f87a (patch)
tree216c89362ca578eeb178252f30816d6e0f41a2b0 /lib/unicode-tokens.el
parent202a873cf31a50b2a0e2e252343723549e196b2d (diff)
Switch order of annotations and substitutions, to allow substitutions to contain
further annotations (e.g. a symbol denotes a bold character or special font). Fix a compatibility issue with MMM (avoid changing encoding on indirect buffer) Fix removing face properties when turning off (re fontify). Don't try to save properties: face (giving up on temporarily on bold) or autocompose.
Diffstat (limited to 'lib/unicode-tokens.el')
-rw-r--r--lib/unicode-tokens.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/unicode-tokens.el b/lib/unicode-tokens.el
index 1074ac23..b6b5c4d7 100644
--- a/lib/unicode-tokens.el
+++ b/lib/unicode-tokens.el
@@ -387,12 +387,12 @@ Also sets `unicode-tokens-token-alist'."
"Value for `format-alist'.")
(defconst unicode-tokens-ignored-properties
- '(vanilla type fontified)
+ '(vanilla type fontified face auto-composed)
"Text properties to ignore when saving files.")
(defconst unicode-tokens-annotation-translations
'((face (bold "bold") ;; NB: clashes with font lock!
- (default ))
+ (default )) ;; not saved now, need another way
(display ((raise 0.4) "superscript")
((raise -0.4) "subscript")
((raise 0.35) "superscript1")
@@ -406,7 +406,10 @@ Also sets `unicode-tokens-token-alist'."
(remove-text-properties
start end
(mapcar 'car
- unicode-tokens-annotation-translations)))
+ unicode-tokens-annotation-translations))
+ ;; Let's put face back in from fontify
+ (font-lock-fontify-buffer))
+
(defun unicode-tokens-tokens-to-unicode (&optional start end)
"Decode a tokenised file for display in Emacs."
@@ -418,12 +421,12 @@ Also sets `unicode-tokens-token-alist'."
(modified (buffer-modified-p))
(inhibit-read-only t))
(setq unicode-tokens-next-control-token-seen-token nil)
+ (format-replace-strings unicode-tokens-token-alist nil (point-min)
+ (point-max))
(format-deannotate-region (point-min)
(point-max)
unicode-tokens-annotation-translations
'unicode-tokens-next-control-token)
- (format-replace-strings unicode-tokens-token-alist nil (point-min)
- (point-max))
(set-buffer-modified-p modified))
(goto-char (point-max)))))
@@ -495,12 +498,12 @@ after next character (single character control sequence)."
(save-restriction
(save-excursion
(narrow-to-region (or start (point-min)) (or end (point-max)))
- (format-replace-strings unicode-tokens-ustring-alist nil (point-min) (point-max))
(format-insert-annotations
(format-annotate-region (point-min) (point-max)
unicode-tokens-annotation-translations
'unicode-tokens-make-token-annotation
unicode-tokens-ignored-properties))
+ (format-replace-strings unicode-tokens-ustring-alist nil (point-min) (point-max))
(set-buffer-modified-p modified)))))
@@ -523,7 +526,9 @@ after next character (single character control sequence)."
(setq text-property-default-nonsticky
;; We want to use display property with stickyness
(delete '(display . t) text-property-default-nonsticky))
- (if (fboundp 'set-buffer-multibyte)
+ (if (and
+ (fboundp 'set-buffer-multibyte)
+ (not (buffer-base-buffer)))
(set-buffer-multibyte t))
(let ((inhibit-read-only t))
;; format is supposed to manage undo, but doesn't remap