diff options
Diffstat (limited to 'lisp/language')
| -rw-r--r-- | lisp/language/european.el | 60 |
1 files changed, 60 insertions, 0 deletions
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. | ||
| 550 | When called from a program, expects two arguments, | ||
| 551 | positions (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. | ||
| 582 | The text matches the regular expression PATTERN. | ||
| 583 | Optional 4th argument STRING, if non-nil, is a string containing text | ||
| 584 | to compose. | ||
| 585 | |||
| 586 | The 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 |