]> code.delx.au - gnu-emacs/blobdiff - lisp/language/thai-word.el
(url-http-mark-connection-as-free, url-http-find-free-connection):
[gnu-emacs] / lisp / language / thai-word.el
index 82f6fcdea6a30a2f2692e4ae7f1595e29fe6f1ff..5584461bf4fba79c3b274c7ea6a21def52654b7e 100644 (file)
@@ -1,7 +1,8 @@
 ;;; thai-word.el -- find Thai word boundaries
 
-;; Copyright (C) 2000, 2001, 2002, 2003, 2004
-;; Electrotechnical Laboratory, JAPAN.
+;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+;;   National Institute of Advanced Industrial Science and Technology (AIST)
+;;   Registration Number H14PRO021
 
 ;; Author: Kenichi HANDA <handa@etl.go.jp>
 
@@ -19,7 +20,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to
-;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;; The used Thai word list has been taken from IBM's ICU4J project
 ;; (file `thai6.ucs', version 1.4, converted to TIS encoding, with
 ;; which means that you can easily index the list character by
 ;; character.
 
-(defconst thai-word-table nil)
-
-
-;; Set up `thai-word-table'.
-
-(let
-    ((l
+(defvar thai-word-table
+  (let ((table (list 'thai-words)))
+    (dolist (elt
+      ;;; The following is indented as this to minimize this file size.
       '("¡¡"
        "¡¡Å"
        "¡¡Ø¸Àѳ±ì"
        "äÎâ¡ÃÁÔàµÍÃì"
        "äÎâ´Ã¤ÒÃìºÍ¹"
        "äÎâÅ"
-       )))
-  (setq thai-word-table (list 'thai-words))
-  (while l
-    (set-nested-alist (car l) 1 thai-word-table)
-    (setq l (cdr l))))
+       ))
+      (set-nested-alist elt 1 table))
+    table)
+  "Nested alist of Thai words.") 
 
 
 (defun thai-update-word-table (file &optional append)
@@ -10783,7 +10781,7 @@ the current word list."
       ;; character by character.
       (while this
        (setq pos (1+ pos)
-             char (char-after pos)
+             char (or (char-after pos) 0)
              category-set (char-category-set char))
        ;; If the current sequence is recorded in `thai-word-table'
        ;; (i.e. (car THIS) is 1) and the following Thai character is
@@ -11042,6 +11040,33 @@ If COUNT is negative, move point forward (- COUNT) words."
   (thai-forward-word (- count)))
 
 
+(defun thai-kill-word (arg)
+  "Like kill-word but pay attention to Thai word boundaries.
+With argument, do this that many times."
+  (interactive "p")
+  (kill-region (point) (progn (thai-forward-word arg) (point))))
+
+
+(defun thai-backward-kill-word (arg)
+  "Like backward-kill-word but pay attention to Thai word boundaries."
+  (interactive "p")
+  (thai-kill-word (- arg)))
+
+
+(defun thai-transpose-words (arg)
+  "Like transpose-words but pay attention to Thai word boundaries."
+  (interactive "*p")
+  (transpose-subr 'thai-forward-word arg))
+
+(defun thai-fill-find-break-point (linebeg)
+  "Go to a line breaking position near point considering Thai word boundaries."
+  (let ((pos (point)))
+    (thai-forward-word -1)
+    (when (<= (point) linebeg)
+      (goto-char pos)
+      (thai-forward-word 1))
+    (kinsoku linebeg)))
+
 (provide 'thai-word)