aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2001-12-07 14:49:08 +0000
committerDave Love2001-12-07 14:49:08 +0000
commit5180cc015e2cca6f8cb635044ac4643cf83276cb (patch)
treea68d62b4649cdc3a64b3fad6c26c5b2bffdb37ae
parent269a5dd0adc17737ef2589084dc6ad1bb98de36a (diff)
downloademacs-5180cc015e2cca6f8cb635044ac4643cf83276cb.tar.gz
emacs-5180cc015e2cca6f8cb635044ac4643cf83276cb.zip
(diacritic-composition-pattern): New constant.
(diacritic-compose-region, diacritic-compose-string) (diacritic-compose-buffer, diacritic-post-read-conversion) (diacritic-composition-function): New functions.
-rw-r--r--lisp/ChangeLog27
-rw-r--r--lisp/language/european.el60
2 files changed, 87 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b950cad7d91..45ee9b4a87a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,30 @@
12001-12-07 Dave Love <fx@gnu.org>
2
3 * language/european.el (diacritic-composition-pattern): New constant.
4 (diacritic-compose-region, diacritic-compose-string)
5 (diacritic-compose-buffer, diacritic-post-read-conversion)
6 (diacritic-composition-function): New functions.
7
8 * international/utf-8.el (ucs-mule-to-mule-unicode): New
9 translation table.
10 (ccl-encode-mule-utf-8): Use it.
11 (utf-8-untranslated-to-ucs, utf-8-help-echo, utf-8-compose)
12 (utf-8-post-read-conversion, utf-8-pre-write-conversion): New
13 function.
14 (utf-8-subst-table): New variable.
15 (utf-8-compose-scripts): New option.
16 (mule-utf-8): Update safe-charsets, pre-write and post-read
17 conversion.
18
19 * international/ucs-tables.el, international/utf-8-subst.el: New
20 file.
21
22 * international/characters.el: Don't set word syntax (the default)
23 explicitly. Add a diacritic category. Add info for Unicode
24 equivalents of characters in various Mule charsets and for extra
25 Unicode characters. Don't define specific categories for
26 Indian/Devanagari, since they aren't used.
27
12001-12-06 Richard M. Stallman <rms@gnu.org> 282001-12-06 Richard M. Stallman <rms@gnu.org>
2 29
3 * textmodes/fill.el (set-justification): Rename arg VALUE to STYLE. 30 * 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."))
542 (valid-codes (0 . 255)) 542 (valid-codes (0 . 255))
543 (mime-charset . macintosh))) ; per IANA, rfc1345 543 (mime-charset . macintosh))) ; per IANA, rfc1345
544 544
545(defconst diacritic-composition-pattern "\\C^\\c^+")
546
547;;;###autoload
548(defun diacritic-compose-region (beg end)
549 "Compose diacritic characters in the region.
550When called from a program, expects two arguments,
551positions (integers or markers) specifying the region."
552 (interactive "r")
553 (save-restriction
554 (narrow-to-region beg end)
555 (goto-char (point-min))
556 (while (re-search-forward diacritic-composition-pattern nil t)
557 (compose-region (match-beginning 0) (match-end 0)))))
558
559;;;###autoload
560(defun diacritic-compose-string (string)
561 "Compose diacritic characters in STRING and return the resulting string."
562 (let ((idx 0))
563 (while (setq idx (string-match diacritic-composition-pattern string idx))
564 (compose-string string idx (match-end 0))
565 (setq idx (match-end 0))))
566 string)
567
568;;;###autoload
569(defun diacritic-compose-buffer ()
570 "Compose diacritic characters in the current buffer."
571 (interactive)
572 (diacritic-compose-region (point-min) (point-max)))
573
574;;;###autoload
575(defun diacritic-post-read-conversion (len)
576 (diacritic-compose-region (point) (+ (point) len))
577 len)
578
579;;;###autoload
580(defun diacritic-composition-function (from to pattern &optional string)
581 "Compose diacritic text in the region FROM and TO.
582The text matches the regular expression PATTERN.
583Optional 4th argument STRING, if non-nil, is a string containing text
584to compose.
585
586The return value is number of composed characters."
587 (if (< (1+ from) to)
588 (prog1 (- to from)
589 (if string
590 (compose-string string from to)
591 (compose-region from to))
592 (- to from))))
593
594;; Register a function to compose Unicode diacrtics and marks.
595(let ((patterns '(("\\C^\\c^+" . diacrtic-composition-function))))
596 (let ((c #x300))
597 (while (<= c #x362)
598 (aset composition-function-table (decode-char 'ucs c) patterns)
599 (setq c (1+ c)))
600 (setq c #x20d0)
601 (while (<= c #x20e3)
602 (aset composition-function-table (decode-char 'ucs c) patterns)
603 (setq c (1+ c)))))
604
545(provide 'european) 605(provide 'european)
546 606
547;;; european.el ends here 607;;; european.el ends here