diff options
author | Eli Zaretskii <eliz@gnu.org> | 2018-05-19 18:17:38 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2018-05-19 18:17:38 +0300 |
commit | 3589c966b743850c29b89b83710783d4ea026770 (patch) | |
tree | f1ccb7411f33d81bdd1875a1ef1e9220ae64d063 /lisp/textmodes/enriched.el | |
parent | 593c367b0727affc739832ab4f4bdb9d7dd1ddd7 (diff) | |
download | emacs-3589c966b743850c29b89b83710783d4ea026770.tar.gz emacs-3589c966b743850c29b89b83710783d4ea026770.tar.bz2 emacs-3589c966b743850c29b89b83710783d4ea026770.zip |
Use Enriched mode in etc/HELLO to keep charset information
This allows to encode HELLO in UTF-8, thus supporting the entire
repertory of Unicode, while still keeping the charset info where
that is important. Suggested by Michael Welsh Duggan <mwd@md5i.com>.
* lisp/textmodes/enriched.el (enriched-translations): Add
translations for 'charset'.
(enriched-decode-charset, enriched-handle-charset-prop): New
functions.
* lisp/facemenu.el (facemenu-special-menu): Add sub-menu for
'charset' property.
(facemenu-set-charset): New function.
(facemenu-remove-special): Remove the 'charset' property as well.
* etc/NEWS: Announce the new feature of Enriched mode.
* etc/HELLO: Recode in UTF-8 and place under Enriched mode.
* doc/emacs/text.texi (Enriched Properties): Mention the support
for 'charset'.
Diffstat (limited to 'lisp/textmodes/enriched.el')
-rw-r--r-- | lisp/textmodes/enriched.el | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el index b9d247132dc..6b4c44a39e7 100644 --- a/lisp/textmodes/enriched.el +++ b/lisp/textmodes/enriched.el @@ -120,9 +120,11 @@ expression, which is evaluated to get the string to insert.") ;; The following are not part of the standard: (FUNCTION (enriched-decode-foreground "x-color") (enriched-decode-background "x-bg-color") - (enriched-decode-display-prop "x-display")) + (enriched-decode-display-prop "x-display") + (enriched-decode-charset "x-charset")) (read-only (t "x-read-only")) (display (nil enriched-handle-display-prop)) + (charset (nil enriched-handle-charset-prop)) (unknown (nil format-annotate-value)) ; (font-size (2 "bigger") ; unimplemented ; (-2 "smaller")) @@ -492,6 +494,21 @@ Return value is \(begin end name positive-p), or nil if none was found." (list from to 'face (list ':background color)) (message "Warning: no color specified for <x-bg-color>") nil)) + +(defun enriched-decode-charset (from to &optional cset) + (let ((cs (when (stringp cset) + (condition-case () + (car (read-from-string cset)) + (error nil))))) + (unless cs + (message "Warning: invalid <x-charset> parameter %s" cset)) + (list from to 'charset cs))) + +(defun enriched-handle-charset-prop (old new) + "Return a list of annotations for a change in the `charset' property." + (cons (and old (list (list "x-charset" (symbol-name old)))) + (and new (list (list "x-charset" (symbol-name new)))))) + ;;; Handling the `display' property. |