1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-07 15:21:46 +00:00

Use lexical-binding in of all lisp/language

* lisp/international/titdic-cnv.el (pinyin-convert):
Enable lexical-binding in the generated file(s).

* lisp/language/ethio-util.el: Use lexical-binding.
(ethio-tex-to-fidel-buffer): Use `inhibit-read-only`.  Remove unused
vars `p` and `ch`.

* lisp/language/hanja-util.el: Use lexical-binding.

* lisp/language/ind-util.el: Use lexical-binding.
(indian-translate-region): Actually use the `from` and `to` arguments.
(<toplevel>): Use `dlet`.  Remove unused var `current-repertory`.
(indian-2-column-to-ucs-region): Remove unused var `pos`.

* lisp/language/japan-util.el: Use lexical-binding.
(japanese-katakana-region, japanese-hiragana-region)
(japanese-zenkaku-region): Remove unused var `next`.

* lisp/language/korea-util.el: Use lexical-binding.

* lisp/language/lao-util.el: Use lexical-binding.
(lao-composition-function): Remove unused var `glyph`.

* lisp/language/thai-util.el: Use lexical-binding.
(thai-composition-function): Remove unused var `glyph`.

* lisp/language/thai-word.el: Use lexical-binding.
(thai-forward-word): Remove unused var `tail`.

* lisp/language/tibet-util.el: Use lexical-binding.
(tibetan-add-components): Remove unused var `tmp`.
(tibetan-compose-region): Remove unused vars `str`, `result`, `chars`.

* lisp/language/viet-util.el:
* lisp/language/tv-util.el:
* lisp/language/cyril-util.el:
* lisp/language/china-util.el: Use lexical-binding.
This commit is contained in:
Stefan Monnier 2021-01-26 21:11:49 -05:00
parent 7c257e2286
commit b0e96e554c
26 changed files with 92 additions and 90 deletions

View File

@ -1212,8 +1212,10 @@ The library is named pinyin.el, and contains the constant
(dst-file (cadr command-line-args-left)) (dst-file (cadr command-line-args-left))
(coding-system-for-write 'utf-8-unix)) (coding-system-for-write 'utf-8-unix))
(with-temp-file dst-file (with-temp-file dst-file
(insert ";; This file is automatically generated from pinyin.map,\ (insert ";;; " (file-name-nondirectory dst-file)
by the\n;; function pinyin-convert.\n\n") " -*- lexical-binding:t -*-
;; This file is automatically generated from pinyin.map, by the
;; function pinyin-convert.\n\n")
(insert "(defconst pinyin-character-map\n'(") (insert "(defconst pinyin-character-map\n'(")
(let ((pos (point))) (let ((pos (point)))
(insert-file-contents src-file) (insert-file-contents src-file)

View File

@ -51,7 +51,7 @@
regexp t t)))) regexp t t))))
regexp)) regexp))
(let ((elt (list (vector burmese-composable-pattern 0 'font-shape-gstring) (let ((elt (list (vector burmese-composable-pattern 0 #'font-shape-gstring)
(vector "." 0 'font-shape-gstring)))) (vector "." 0 #'font-shape-gstring))))
(set-char-table-range composition-function-table '(#x1000 . #x107F) elt) (set-char-table-range composition-function-table '(#x1000 . #x107F) elt)
(set-char-table-range composition-function-table '(#xAA60 . #xAA7B) elt)) (set-char-table-range composition-function-table '(#xAA60 . #xAA7B) elt))

View File

@ -29,7 +29,7 @@
(set-char-table-range composition-function-table (set-char-table-range composition-function-table
'(#xAA00 . #xAA5F) '(#xAA00 . #xAA5F)
(list (vector "[\xAA00-\xAA5F]+" 0 'font-shape-gstring))) (list (vector "[\xAA00-\xAA5F]+" 0 #'font-shape-gstring)))
(set-language-info-alist (set-language-info-alist
"Cham" '((charset unicode) "Cham" '((charset unicode)

View File

@ -1,4 +1,4 @@
;;; china-util.el --- utilities for Chinese -*- coding: utf-8 -*- ;;; china-util.el --- utilities for Chinese -*- lexical-binding: t; -*-
;; Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,

View File

@ -1,4 +1,4 @@
;;; cyril-util.el --- utilities for Cyrillic scripts ;;; cyril-util.el --- utilities for Cyrillic scripts -*- lexical-binding: t; -*-
;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.

View File

@ -1,4 +1,4 @@
;;; ethio-util.el --- utilities for Ethiopic -*- coding: utf-8-emacs; -*- ;;; ethio-util.el --- utilities for Ethiopic -*- coding: utf-8-emacs; lexical-binding: t; -*-
;; Copyright (C) 1997-1998, 2002-2021 Free Software Foundation, Inc. ;; Copyright (C) 1997-1998, 2002-2021 Free Software Foundation, Inc.
;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
@ -832,11 +832,12 @@ The 2nd and 3rd arguments BEGIN and END specify the region."
(set-buffer-modified-p nil))) (set-buffer-modified-p nil)))
;;;###autoload ;;;###autoload
(defun ethio-tex-to-fidel-buffer nil (defun ethio-tex-to-fidel-buffer ()
"Convert fidel-tex commands in the current buffer into fidel chars." "Convert fidel-tex commands in the current buffer into fidel chars."
(interactive) (interactive)
(let ((buffer-read-only nil) (let ((inhibit-read-only t)
(p) (ch)) ;; (p) (ch)
)
;; TeX macros to Ethiopic characters ;; TeX macros to Ethiopic characters
(robin-convert-region (point-min) (point-max) "ethiopic-tex") (robin-convert-region (point-min) (point-max) "ethiopic-tex")
@ -1018,7 +1019,7 @@ With ARG, insert that many delimiters."
;; ;;
;;;###autoload ;;;###autoload
(defun ethio-composition-function (pos to font-object string _direction) (defun ethio-composition-function (pos _to _font-object string _direction)
(setq pos (1- pos)) (setq pos (1- pos))
(let ((pattern "\\ce\\(፟\\|<7C><><EFBFBD><EFBFBD>\\)")) (let ((pattern "\\ce\\(፟\\|<7C><><EFBFBD><EFBFBD>\\)"))
(if string (if string

View File

@ -79,8 +79,8 @@
))) )))
;; For automatic composition ;; For automatic composition
(aset composition-function-table ?<3F><EFBFBD><EFBFBD><EFBFBD> 'ethio-composition-function) (aset composition-function-table ?<3F><EFBFBD><EFBFBD><EFBFBD> #'ethio-composition-function)
(aset composition-function-table ?፟ 'ethio-composition-function) (aset composition-function-table ?፟ #'ethio-composition-function)
(provide 'ethiopic) (provide 'ethiopic)

View File

@ -1,4 +1,4 @@
;;; hanja-util.el --- Korean Hanja util module -*- coding: utf-8 -*- ;;; hanja-util.el --- Korean Hanja util module -*- lexical-binding: t; -*-
;; Copyright (C) 2008-2021 Free Software Foundation, Inc. ;; Copyright (C) 2008-2021 Free Software Foundation, Inc.

View File

@ -245,9 +245,9 @@ Bidirectional editing is supported.")))
(pattern2 (concat base "\u200D" combining))) (pattern2 (concat base "\u200D" combining)))
(set-char-table-range (set-char-table-range
composition-function-table '(#x591 . #x5C7) composition-function-table '(#x591 . #x5C7)
(list (vector pattern2 3 'hebrew-shape-gstring) (list (vector pattern2 3 #'hebrew-shape-gstring)
(vector pattern2 2 'hebrew-shape-gstring) (vector pattern2 2 #'hebrew-shape-gstring)
(vector pattern1 1 'hebrew-shape-gstring) (vector pattern1 1 #'hebrew-shape-gstring)
[nil 0 hebrew-shape-gstring])) [nil 0 hebrew-shape-gstring]))
;; Exclude non-combining characters. ;; Exclude non-combining characters.
(set-char-table-range (set-char-table-range

View File

@ -1,4 +1,4 @@
;;; ind-util.el --- Transliteration and Misc. Tools for Indian Languages -*- coding: utf-8-emacs; -*- ;;; ind-util.el --- Transliteration and Misc. Tools for Indian Languages -*- coding: utf-8-emacs; lexical-binding: t; -*-
;; Copyright (C) 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
@ -40,7 +40,7 @@
(defun indian-regexp-of-hashtbl-keys (hashtbl) (defun indian-regexp-of-hashtbl-keys (hashtbl)
"Return the regular expression of hash table keys." "Return the regular expression of hash table keys."
(let (keys) (let (keys)
(maphash (lambda (key val) (push key keys)) hashtbl) (maphash (lambda (key _val) (push key keys)) hashtbl)
(regexp-opt keys))) (regexp-opt keys)))
(defvar indian-dev-base-table (defvar indian-dev-base-table
@ -565,7 +565,7 @@
(let ((regexp ,(indian-regexp-of-hashtbl-keys (let ((regexp ,(indian-regexp-of-hashtbl-keys
(if encode-p (car (eval hashtable)) (if encode-p (car (eval hashtable))
(cdr (eval hashtable)))))) (cdr (eval hashtable))))))
(narrow-to-region from to) (narrow-to-region ,from ,to)
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward regexp nil t) (while (re-search-forward regexp nil t)
(let ((matchstr (gethash (match-string 0) (let ((matchstr (gethash (match-string 0)
@ -613,7 +613,7 @@
;; The followings provide conversion between IS 13194 (ISCII) and UCS. ;; The followings provide conversion between IS 13194 (ISCII) and UCS.
(let (dlet
;;Unicode vs IS13194 ;; only Devanagari is supported now. ;;Unicode vs IS13194 ;; only Devanagari is supported now.
((ucs-devanagari-to-is13194-alist ((ucs-devanagari-to-is13194-alist
'((?\x0900 . "[U+0900]") '((?\x0900 . "[U+0900]")
@ -820,11 +820,11 @@ Returns new end position."
(save-restriction (save-restriction
(narrow-to-region from to) (narrow-to-region from to)
(goto-char (point-min)) (goto-char (point-min))
(let* ((current-repertory is13194-default-repertory)) ;; (let* ((current-repertory is13194-default-repertory))
(while (re-search-forward indian-ucs-to-is13194-regexp nil t) (while (re-search-forward indian-ucs-to-is13194-regexp nil t)
(replace-match (replace-match
(get-char-code-property (string-to-char (match-string 0)) (get-char-code-property (string-to-char (match-string 0))
'iscii)))) 'iscii)));; )
(point-max)))) (point-max))))
(defun indian-iscii-to-ucs-region (from to) (defun indian-iscii-to-ucs-region (from to)
@ -1246,7 +1246,7 @@ Returns new end position."
(interactive "r") (interactive "r")
(save-excursion (save-excursion
(save-restriction (save-restriction
(let ((pos from) (let (;; (pos from)
(alist (char-table-extra-slot indian-2-column-to-ucs-chartable 0))) (alist (char-table-extra-slot indian-2-column-to-ucs-chartable 0)))
(narrow-to-region from to) (narrow-to-region from to)
(decompose-region from to) (decompose-region from to)

View File

@ -381,7 +381,7 @@ South Indian language Malayalam is supported in this language environment."))
(if slot (if slot
(set-char-table-range (set-char-table-range
composition-function-table key composition-function-table key
(list (vector (cdr slot) 0 'font-shape-gstring)))))) (list (vector (cdr slot) 0 #'font-shape-gstring))))))
char-script-table)) char-script-table))
(provide 'indian) (provide 'indian)

View File

@ -1,4 +1,4 @@
;;; japan-util.el --- utilities for Japanese ;;; japan-util.el --- utilities for Japanese -*- lexical-binding: t; -*-
;; Copyright (C) 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@ -236,7 +236,7 @@ of which charset is `japanese-jisx0201-kana'."
(composition (composition
(and (not hankaku) (and (not hankaku)
(get-char-code-property kana 'kana-composition))) (get-char-code-property kana 'kana-composition)))
next slot) slot) ;; next
(if (and composition (setq slot (assq (following-char) composition))) (if (and composition (setq slot (assq (following-char) composition)))
(japanese-replace-region (match-beginning 0) (1+ (point)) (japanese-replace-region (match-beginning 0) (1+ (point))
(cdr slot)) (cdr slot))
@ -258,7 +258,7 @@ of which charset is `japanese-jisx0201-kana'."
(while (re-search-forward "\\cK\\|\\ck" nil t) (while (re-search-forward "\\cK\\|\\ck" nil t)
(let* ((kata (preceding-char)) (let* ((kata (preceding-char))
(composition (get-char-code-property kata 'kana-composition)) (composition (get-char-code-property kata 'kana-composition))
next slot) slot) ;; next
(if (and composition (setq slot (assq (following-char) composition))) (if (and composition (setq slot (assq (following-char) composition)))
(japanese-replace-region (match-beginning 0) (1+ (point)) (japanese-replace-region (match-beginning 0) (1+ (point))
(get-char-code-property (get-char-code-property
@ -305,7 +305,7 @@ Optional argument KATAKANA-ONLY non-nil means to convert only KATAKANA char."
(re-search-forward "\\ca\\|\\ck" nil t))) (re-search-forward "\\ca\\|\\ck" nil t)))
(let* ((hankaku (preceding-char)) (let* ((hankaku (preceding-char))
(composition (get-char-code-property hankaku 'kana-composition)) (composition (get-char-code-property hankaku 'kana-composition))
next slot) slot) ;; next
(if (and composition (setq slot (assq (following-char) composition))) (if (and composition (setq slot (assq (following-char) composition)))
(japanese-replace-region (match-beginning 0) (1+ (point)) (japanese-replace-region (match-beginning 0) (1+ (point))
(cdr slot)) (cdr slot))

View File

@ -31,7 +31,7 @@
(documentation . t))) (documentation . t)))
(let ((val (list (vector "[\x1780-\x17FF\x19E0-\x19FF\x200C\x200D]+" (let ((val (list (vector "[\x1780-\x17FF\x19E0-\x19FF\x200C\x200D]+"
0 'font-shape-gstring)))) 0 #'font-shape-gstring))))
(set-char-table-range composition-function-table '(#x1780 . #x17FF) val) (set-char-table-range composition-function-table '(#x1780 . #x17FF) val)
(set-char-table-range composition-function-table '(#x19E0 . #x19FF) val)) (set-char-table-range composition-function-table '(#x19E0 . #x19FF) val))

View File

@ -1,4 +1,4 @@
;;; korea-util.el --- utilities for Korean ;;; korea-util.el --- utilities for Korean -*- lexical-binding: t; -*-
;; Copyright (C) 1997, 1999, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1997, 1999, 2001-2021 Free Software Foundation, Inc.
;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@ -45,7 +45,7 @@
(activate-input-method (activate-input-method
(concat "korean-hangul" default-korean-keyboard)))) (concat "korean-hangul" default-korean-keyboard))))
(defun quail-hangul-switch-symbol-ksc (&rest ignore) (defun quail-hangul-switch-symbol-ksc (&rest _ignore)
"Switch to/from Korean symbol package." "Switch to/from Korean symbol package."
(interactive "i") (interactive "i")
(and current-input-method (and current-input-method
@ -54,7 +54,7 @@
default-korean-keyboard)) default-korean-keyboard))
(activate-input-method "korean-symbol")))) (activate-input-method "korean-symbol"))))
(defun quail-hangul-switch-hanja (&rest ignore) (defun quail-hangul-switch-hanja (&rest _ignore)
"Switch to/from Korean hanja package." "Switch to/from Korean hanja package."
(interactive "i") (interactive "i")
(and current-input-method (and current-input-method

View File

@ -92,10 +92,10 @@ and the following key bindings are available within Korean input methods:
(pattern (concat choseong jungseong jongseong))) (pattern (concat choseong jungseong jongseong)))
(set-char-table-range composition-function-table (set-char-table-range composition-function-table
'(#x1100 . #x115F) '(#x1100 . #x115F)
(list (vector pattern 0 'font-shape-gstring))) (list (vector pattern 0 #'font-shape-gstring)))
(set-char-table-range composition-function-table (set-char-table-range composition-function-table
'(#xA960 . #xA97C) '(#xA960 . #xA97C)
(list (vector pattern 0 'font-shape-gstring)))) (list (vector pattern 0 #'font-shape-gstring))))
(provide 'korean) (provide 'korean)

View File

@ -1,4 +1,4 @@
;;; lao-util.el --- utilities for Lao -*- coding: utf-8; -*- ;;; lao-util.el --- utilities for Lao -*- lexical-binding: t; -*-
;; Copyright (C) 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@ -498,10 +498,10 @@ syllable. In that case, FROM and TO are indexes to STR."
(compose-gstring-for-graphic gstring direction) (compose-gstring-for-graphic gstring direction)
(or (font-shape-gstring gstring direction) (or (font-shape-gstring gstring direction)
(let ((glyph-len (lgstring-glyph-len gstring)) (let ((glyph-len (lgstring-glyph-len gstring))
(i 0) (i 0)) ;; glyph
glyph)
(while (and (< i glyph-len) (while (and (< i glyph-len)
(setq glyph (lgstring-glyph gstring i))) ;; (setq glyph
(lgstring-glyph gstring i)) ;;)
(setq i (1+ i))) (setq i (1+ i)))
(compose-glyph-string-relative gstring 0 i 0.1))))) (compose-glyph-string-relative gstring 0 i 0.1)))))

View File

@ -66,7 +66,7 @@
(t (string c)))) (t (string c))))
(cdr l) "")) (cdr l) ""))
;; Element of composition-function-table. ;; Element of composition-function-table.
(elt (list (vector regexp 1 'lao-composition-function) (elt (list (vector regexp 1 #'lao-composition-function)
fallback-rule)) fallback-rule))
ch) ch)
(dotimes (i len) (dotimes (i len)

View File

@ -137,9 +137,9 @@ thin (i.e. 1-dot width) space."
composition-function-table composition-function-table
'(#x600 . #x74F) '(#x600 . #x74F)
(list (vector "[\u200C\u200D][\u0600-\u074F\u200C\u200D]+" (list (vector "[\u200C\u200D][\u0600-\u074F\u200C\u200D]+"
1 'arabic-shape-gstring) 1 #'arabic-shape-gstring)
(vector "[\u0600-\u074F\u200C\u200D]+" (vector "[\u0600-\u074F\u200C\u200D]+"
0 'arabic-shape-gstring))) 0 #'arabic-shape-gstring)))
;; The Egyptian Hieroglyph Format Controls were introduced in Unicode ;; The Egyptian Hieroglyph Format Controls were introduced in Unicode
;; Standard v12.0. Apparently, they are not yet well supported in ;; Standard v12.0. Apparently, they are not yet well supported in
@ -186,13 +186,13 @@ thin (i.e. 1-dot width) space."
;; doesn't support these controls, the glyphs are ;; doesn't support these controls, the glyphs are
;; displayed individually, and not as a single ;; displayed individually, and not as a single
;; grapheme cluster. ;; grapheme cluster.
1 'font-shape-gstring))) 1 #'font-shape-gstring)))
;; Grouping controls ;; Grouping controls
(set-char-table-range (set-char-table-range
composition-function-table composition-function-table
#x13437 #x13437
(list (vector "\U00013437[\U00013000-\U0001343F]+" (list (vector "\U00013437[\U00013000-\U0001343F]+"
0 'egyptian-shape-grouping)))) 0 #'egyptian-shape-grouping))))
(provide 'misc-lang) (provide 'misc-lang)

View File

@ -43,6 +43,6 @@
"[\u0D85-\u0D96][\u0D82-\u0D83]?\\|" "[\u0D85-\u0D96][\u0D82-\u0D83]?\\|"
;; any other singleton characters ;; any other singleton characters
"[\u0D80-\u0DFF]") "[\u0D80-\u0DFF]")
0 'font-shape-gstring))) 0 #'font-shape-gstring)))
;; sinhala.el ends here ;; sinhala.el ends here

View File

@ -30,7 +30,7 @@
(set-char-table-range composition-function-table (set-char-table-range composition-function-table
'(#xAA80 . #xAADF) '(#xAA80 . #xAADF)
'tai-viet-composition-function) #'tai-viet-composition-function)
(set-language-info-alist (set-language-info-alist
"TaiViet" '((charset unicode) "TaiViet" '((charset unicode)

View File

@ -1,4 +1,4 @@
;;; thai-util.el --- utilities for Thai -*- coding: utf-8; -*- ;;; thai-util.el --- utilities for Thai -*- lexical-binding: t; -*-
;; Copyright (C) 2000-2021 Free Software Foundation, Inc. ;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@ -232,10 +232,10 @@ positions (integers or markers) specifying the region."
(let ((glyph-len (lgstring-glyph-len gstring)) (let ((glyph-len (lgstring-glyph-len gstring))
(last-char (lgstring-char gstring (last-char (lgstring-char gstring
(1- (lgstring-char-len gstring)))) (1- (lgstring-char-len gstring))))
(i 0) (i 0)) ;; glyph
glyph)
(while (and (< i glyph-len) (while (and (< i glyph-len)
(setq glyph (lgstring-glyph gstring i))) ;; (setq glyph
(lgstring-glyph gstring i)) ;; )
(setq i (1+ i))) (setq i (1+ i)))
(if (= last-char ?ำ) (if (= last-char ?ำ)
(setq i (1- i))) (setq i (1- i)))

View File

@ -1,4 +1,4 @@
;;; thai-word.el -- find Thai word boundaries ;;; thai-word.el -- find Thai word boundaries -*- lexical-binding: t; -*-
;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
;; National Institute of Advanced Industrial Science and Technology (AIST) ;; National Institute of Advanced Industrial Science and Technology (AIST)
@ -10973,8 +10973,7 @@ If COUNT is negative, move point backward (- COUNT) words."
;; special instead of using forward-word. ;; special instead of using forward-word.
(let ((start (point)) (let ((start (point))
(limit (match-end 0)) (limit (match-end 0))
boundaries boundaries) ;; tail
tail)
;; If thai-forward-word has been called within a Thai ;; If thai-forward-word has been called within a Thai
;; region, we must go back until the Thai region starts ;; region, we must go back until the Thai region starts
;; to do the contextual analysis for finding word ;; to do the contextual analysis for finding word

View File

@ -1,4 +1,4 @@
;;; tibet-util.el --- utilities for Tibetan -*- coding: utf-8-emacs; -*- ;;; tibet-util.el --- utilities for Tibetan -*- coding: utf-8-emacs; lexical-binding: t; -*-
;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@ -126,42 +126,42 @@ The returned string has no composition information."
(setq t-str-list (cons (substring str idx) t-str-list))) (setq t-str-list (cons (substring str idx) t-str-list)))
(apply 'concat (nreverse t-str-list)))) (apply 'concat (nreverse t-str-list))))
;;; ;;
;;; Functions for composing/decomposing Tibetan sequence. ;;; Functions for composing/decomposing Tibetan sequence.
;;; ;;
;;; A Tibetan syllable is typically structured as follows: ;; A Tibetan syllable is typically structured as follows:
;;; ;;
;;; [Prefix] C [C+] V [M] [Suffix [Post suffix]] ;; [Prefix] C [C+] V [M] [Suffix [Post suffix]]
;;; ;;
;;; where C's are all vertically stacked, V appears below or above ;; where C's are all vertically stacked, V appears below or above
;;; consonant cluster and M is always put above the C[C+]V combination. ;; consonant cluster and M is always put above the C[C+]V combination.
;;; (Sanskrit visarga, though it is a vowel modifier, is considered ;; (Sanskrit visarga, though it is a vowel modifier, is considered
;;; to be a punctuation.) ;; to be a punctuation.)
;;; ;;
;;; Here are examples of the words "bsgrubs" and "hfauM" ;; Here are examples of the words "bsgrubs" and "hfauM"
;;; ;;
;;; བསྒྲུབས ཧཱུཾ ;; བསྒྲུབས ཧཱུཾ
;;; ;;
;;; M ;; M
;;; b s b s h ;; b s b s h
;;; g fa ;; g fa
;;; r u ;; r u
;;; u ;; u
;;; ;;
;;; Consonants `'' (འ), `w' (ཝ), `y' (ཡ), `r' (ར) take special ;; Consonants `'' (འ), `w' (ཝ), `y' (ཡ), `r' (ར) take special
;;; forms when they are used as subjoined consonant. Consonant `r' ;; forms when they are used as subjoined consonant. Consonant `r'
;;; takes another special form when used as superjoined in such a case ;; takes another special form when used as superjoined in such a case
;;; as "rka", while it does not change its form when conjoined with ;; as "rka", while it does not change its form when conjoined with
;;; subjoined `'', `w' or `y' as in "rwa", "rya". ;; subjoined `'', `w' or `y' as in "rwa", "rya".
;; Append a proper composition rule and glyph to COMPONENTS to compose ; Append a proper composition rule and glyph to COMPONENTS to compose
;; CHAR with a composition that has COMPONENTS. ; CHAR with a composition that has COMPONENTS.
(defun tibetan-add-components (components char) (defun tibetan-add-components (components char)
(let ((last (last components)) (let ((last (last components))
(stack-upper '(tc . bc)) (stack-upper '(tc . bc))
(stack-under '(bc . tc)) (stack-under '(bc . tc))
rule comp-vowel tmp) rule comp-vowel)
;; Special treatment for 'a chung. ;; Special treatment for 'a chung.
;; If 'a follows a consonant, turn it into the subjoined form. ;; If 'a follows a consonant, turn it into the subjoined form.
;; * Disabled by Tomabechi 2000/06/09 * ;; * Disabled by Tomabechi 2000/06/09 *
@ -246,7 +246,7 @@ The returned string has no composition information."
(defun tibetan-compose-region (beg end) (defun tibetan-compose-region (beg end)
"Compose Tibetan text the region BEG and END." "Compose Tibetan text the region BEG and END."
(interactive "r") (interactive "r")
(let (str result chars) ;; (let (str result chars)
(save-excursion (save-excursion
(save-restriction (save-restriction
(narrow-to-region beg end) (narrow-to-region beg end)
@ -272,7 +272,7 @@ The returned string has no composition information."
(while (< (point) to) (while (< (point) to)
(tibetan-add-components components (following-char)) (tibetan-add-components components (following-char))
(forward-char 1)) (forward-char 1))
(compose-region from to components))))))) (compose-region from to components)))))) ;; )
(defvar tibetan-decompose-precomposition-alist (defvar tibetan-decompose-precomposition-alist
(mapcar (lambda (x) (cons (string-to-char (cdr x)) (car x))) (mapcar (lambda (x) (cons (string-to-char (cdr x)) (car x)))

View File

@ -605,7 +605,7 @@ This also matches some punctuation characters which need conversion.")
;; For automatic composition. ;; For automatic composition.
(set-char-table-range (set-char-table-range
composition-function-table '(#xF00 . #xFD1) composition-function-table '(#xF00 . #xFD1)
(list (vector tibetan-composable-pattern 0 'font-shape-gstring))) (list (vector tibetan-composable-pattern 0 #'font-shape-gstring)))
(provide 'tibetan) (provide 'tibetan)

View File

@ -1,4 +1,4 @@
;;; tv-util.el --- support for Tai Viet -*- coding: utf-8 -*- ;;; tv-util.el --- support for Tai Viet -*- lexical-binding: t; -*-
;; Copyright (C) 2007, 2008, 2009, 2010, 2011 ;; Copyright (C) 2007, 2008, 2009, 2010, 2011
;; National Institute of Advanced Industrial Science and Technology (AIST) ;; National Institute of Advanced Industrial Science and Technology (AIST)
@ -128,7 +128,7 @@
;;;###autoload ;;;###autoload
(defun tai-viet-composition-function (from to font-object string _direction) (defun tai-viet-composition-function (from _to _font-object string _direction)
(if string (if string
(if (string-match tai-viet-re string from) (if (string-match tai-viet-re string from)
(tai-viet-compose-string from (match-end 0) string)) (tai-viet-compose-string from (match-end 0) string))

View File

@ -1,4 +1,4 @@
;;; viet-util.el --- utilities for Vietnamese -*- coding: utf-8; -*- ;;; viet-util.el --- utilities for Vietnamese -*- lexical-binding: t; -*-
;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,