From 5180cc015e2cca6f8cb635044ac4643cf83276cb Mon Sep 17 00:00:00 2001 From: Dave Love Date: Fri, 7 Dec 2001 14:49:08 +0000 Subject: [PATCH] (diacritic-composition-pattern): New constant. (diacritic-compose-region, diacritic-compose-string) (diacritic-compose-buffer, diacritic-post-read-conversion) (diacritic-composition-function): New functions. --- lisp/ChangeLog | 27 ++++++++++++++++++ lisp/language/european.el | 60 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b950cad7d91..45ee9b4a87a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,30 @@ +2001-12-07 Dave Love + + * language/european.el (diacritic-composition-pattern): New constant. + (diacritic-compose-region, diacritic-compose-string) + (diacritic-compose-buffer, diacritic-post-read-conversion) + (diacritic-composition-function): New functions. + + * international/utf-8.el (ucs-mule-to-mule-unicode): New + translation table. + (ccl-encode-mule-utf-8): Use it. + (utf-8-untranslated-to-ucs, utf-8-help-echo, utf-8-compose) + (utf-8-post-read-conversion, utf-8-pre-write-conversion): New + function. + (utf-8-subst-table): New variable. + (utf-8-compose-scripts): New option. + (mule-utf-8): Update safe-charsets, pre-write and post-read + conversion. + + * international/ucs-tables.el, international/utf-8-subst.el: New + file. + + * international/characters.el: Don't set word syntax (the default) + explicitly. Add a diacritic category. Add info for Unicode + equivalents of characters in various Mule charsets and for extra + Unicode characters. Don't define specific categories for + Indian/Devanagari, since they aren't used. + 2001-12-06 Richard M. Stallman * textmodes/fill.el (set-justification): Rename arg VALUE to STYLE. diff --git a/lisp/language/european.el b/lisp/language/european.el index 1fd230521ec..4020339376f 100644 --- a/lisp/language/european.el +++ b/lisp/language/european.el @@ -542,6 +542,66 @@ but select's the Dutch tutorial.")) (valid-codes (0 . 255)) (mime-charset . macintosh))) ; per IANA, rfc1345 +(defconst diacritic-composition-pattern "\\C^\\c^+") + +;;;###autoload +(defun diacritic-compose-region (beg end) + "Compose diacritic characters in the region. +When called from a program, expects two arguments, +positions (integers or markers) specifying the region." + (interactive "r") + (save-restriction + (narrow-to-region beg end) + (goto-char (point-min)) + (while (re-search-forward diacritic-composition-pattern nil t) + (compose-region (match-beginning 0) (match-end 0))))) + +;;;###autoload +(defun diacritic-compose-string (string) + "Compose diacritic characters in STRING and return the resulting string." + (let ((idx 0)) + (while (setq idx (string-match diacritic-composition-pattern string idx)) + (compose-string string idx (match-end 0)) + (setq idx (match-end 0)))) + string) + +;;;###autoload +(defun diacritic-compose-buffer () + "Compose diacritic characters in the current buffer." + (interactive) + (diacritic-compose-region (point-min) (point-max))) + +;;;###autoload +(defun diacritic-post-read-conversion (len) + (diacritic-compose-region (point) (+ (point) len)) + len) + +;;;###autoload +(defun diacritic-composition-function (from to pattern &optional string) + "Compose diacritic text in the region FROM and TO. +The text matches the regular expression PATTERN. +Optional 4th argument STRING, if non-nil, is a string containing text +to compose. + +The return value is number of composed characters." + (if (< (1+ from) to) + (prog1 (- to from) + (if string + (compose-string string from to) + (compose-region from to)) + (- to from)))) + +;; Register a function to compose Unicode diacrtics and marks. +(let ((patterns '(("\\C^\\c^+" . diacrtic-composition-function)))) + (let ((c #x300)) + (while (<= c #x362) + (aset composition-function-table (decode-char 'ucs c) patterns) + (setq c (1+ c))) + (setq c #x20d0) + (while (<= c #x20e3) + (aset composition-function-table (decode-char 'ucs c) patterns) + (setq c (1+ c))))) + (provide 'european) ;;; european.el ends here -- 2.39.2