/[emacs]/emacs/lisp/language/european.el
ViewVC logotype

Diff of /emacs/lisp/language/european.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.63 by monnier, Sun Nov 18 03:56:19 2001 UTC revision 1.64 by fx, Fri Dec 7 14:48:40 2001 UTC
# Line 542  but select's the Dutch tutorial.")) Line 542  but select's the Dutch tutorial."))
542     (valid-codes (0 . 255))     (valid-codes (0 . 255))
543     (mime-charset . macintosh)))         ; per IANA, rfc1345     (mime-charset . macintosh)))         ; per IANA, rfc1345
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    
605  (provide 'european)  (provide 'european)
606    
607  ;;; european.el ends here  ;;; european.el ends here

Legend:
Removed from v.1.63  
changed lines
  Added in v.1.64

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26