1 |
;;; thai-util.el --- utilities for Thai -*- coding: iso-2022-7bit; -*- |
;;; thai-util.el --- utilities for Thai -*- coding: iso-2022-7bit; -*- |
2 |
|
|
3 |
;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. |
;; Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2005 |
|
;; Licensed to the Free Software Foundation. |
|
|
;; Copyright (C) 2005 |
|
4 |
;; National Institute of Advanced Industrial Science and Technology (AIST) |
;; National Institute of Advanced Industrial Science and Technology (AIST) |
5 |
;; Registration Number H14PRO021 |
;; Registration Number H14PRO021 |
6 |
|
|
380 |
(t |
(t |
381 |
(add-hook 'after-change-functions 'thai-auto-composition)))) |
(add-hook 'after-change-functions 'thai-auto-composition)))) |
382 |
|
|
383 |
|
;; Thai-word-mode requires functions in the feature `thai-word'. |
384 |
|
(require 'thai-word) |
385 |
|
|
386 |
|
(defvar thai-word-mode-map |
387 |
|
(let ((map (make-sparse-keymap))) |
388 |
|
(define-key map [remap forward-word] 'thai-forward-word) |
389 |
|
(define-key map [remap backward-word] 'thai-backward-word) |
390 |
|
(define-key map [remap kill-word] 'thai-kill-word) |
391 |
|
(define-key map [remap backward-kill-word] 'thai-backward-kill-word) |
392 |
|
(define-key map [remap transpose-words] 'thai-transpose-words) |
393 |
|
map) |
394 |
|
"Keymap for `thai-word-mode'.") |
395 |
|
|
396 |
|
(define-minor-mode thai-word-mode |
397 |
|
"Minor mode to make word-oriented commands aware of Thai words. |
398 |
|
The commands affected are \\[forward-word], \\[backward-word], \\[kill-word], \\[backward-kill-word], \\[transpose-words], and \\[fill-paragraph]." |
399 |
|
:global t |
400 |
|
(cond (thai-word-mode |
401 |
|
;; This enables linebreak between Thai characters. |
402 |
|
(modify-category-entry (make-char 'thai-tis620) ?|) |
403 |
|
;; This enables linebreak at a Thai word boundary. |
404 |
|
(put-charset-property 'thai-tis620 'fill-find-break-point-function |
405 |
|
'thai-fill-find-break-point)) |
406 |
|
(t |
407 |
|
(modify-category-entry (make-char 'thai-tis620) ?| nil t) |
408 |
|
(put-charset-property 'thai-tis620 'fill-find-break-point-function |
409 |
|
nil)))) |
410 |
|
|
411 |
|
;; Function to call on entering the Thai language environment. |
412 |
|
(defun setup-thai-language-environment-internal () |
413 |
|
(thai-word-mode 1)) |
414 |
|
|
415 |
|
;; Function to call on exiting the Thai language environment. |
416 |
|
(defun exit-thai-language-environment-internal () |
417 |
|
(thai-word-mode -1)) |
418 |
|
|
419 |
;; |
;; |
420 |
(provide 'thai-util) |
(provide 'thai-util) |
421 |
|
|