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))
(coding-system-for-write 'utf-8-unix))
(with-temp-file dst-file
(insert ";; This file is automatically generated from pinyin.map,\
by the\n;; function pinyin-convert.\n\n")
(insert ";;; " (file-name-nondirectory dst-file)
" -*- lexical-binding:t -*-
;; This file is automatically generated from pinyin.map, by the
;; function pinyin-convert.\n\n")
(insert "(defconst pinyin-character-map\n'(")
(let ((pos (point)))
(insert-file-contents src-file)

View file

@ -51,7 +51,7 @@
regexp t t))))
regexp))
(let ((elt (list (vector burmese-composable-pattern 0 'font-shape-gstring)
(vector "." 0 'font-shape-gstring))))
(let ((elt (list (vector burmese-composable-pattern 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 '(#xAA60 . #xAA7B) elt))

View file

@ -29,7 +29,7 @@
(set-char-table-range composition-function-table
'(#xAA00 . #xAA5F)
(list (vector "[\xAA00-\xAA5F]+" 0 'font-shape-gstring)))
(list (vector "[\xAA00-\xAA5F]+" 0 #'font-shape-gstring)))
(set-language-info-alist
"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, 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.

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, 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)))
;;;###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."
(interactive)
(let ((buffer-read-only nil)
(p) (ch))
(let ((inhibit-read-only t)
;; (p) (ch)
)
;; TeX macros to Ethiopic characters
(robin-convert-region (point-min) (point-max) "ethiopic-tex")
@ -1018,7 +1019,7 @@ With ARG, insert that many delimiters."
;;
;;;###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))
(let ((pattern "\\ce\\(፟\\|<7C><><EFBFBD><EFBFBD>\\)"))
(if string

View file

@ -79,8 +79,8 @@
)))
;; For automatic composition
(aset composition-function-table ?<3F><EFBFBD><EFBFBD><EFBFBD> 'ethio-composition-function)
(aset composition-function-table ?፟ 'ethio-composition-function)
(aset composition-function-table ?<3F><EFBFBD><EFBFBD><EFBFBD> #'ethio-composition-function)
(aset composition-function-table ?፟ #'ethio-composition-function)
(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.

View file

@ -245,9 +245,9 @@ Bidirectional editing is supported.")))
(pattern2 (concat base "\u200D" combining)))
(set-char-table-range
composition-function-table '(#x591 . #x5C7)
(list (vector pattern2 3 'hebrew-shape-gstring)
(vector pattern2 2 'hebrew-shape-gstring)
(vector pattern1 1 'hebrew-shape-gstring)
(list (vector pattern2 3 #'hebrew-shape-gstring)
(vector pattern2 2 #'hebrew-shape-gstring)
(vector pattern1 1 #'hebrew-shape-gstring)
[nil 0 hebrew-shape-gstring]))
;; Exclude non-combining characters.
(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.
@ -40,7 +40,7 @@
(defun indian-regexp-of-hashtbl-keys (hashtbl)
"Return the regular expression of hash table keys."
(let (keys)
(maphash (lambda (key val) (push key keys)) hashtbl)
(maphash (lambda (key _val) (push key keys)) hashtbl)
(regexp-opt keys)))
(defvar indian-dev-base-table
@ -565,7 +565,7 @@
(let ((regexp ,(indian-regexp-of-hashtbl-keys
(if encode-p (car (eval hashtable))
(cdr (eval hashtable))))))
(narrow-to-region from to)
(narrow-to-region ,from ,to)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(let ((matchstr (gethash (match-string 0)
@ -613,7 +613,7 @@
;; The followings provide conversion between IS 13194 (ISCII) and UCS.
(let
(dlet
;;Unicode vs IS13194 ;; only Devanagari is supported now.
((ucs-devanagari-to-is13194-alist
'((?\x0900 . "[U+0900]")
@ -820,11 +820,11 @@ Returns new end position."
(save-restriction
(narrow-to-region from to)
(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)
(replace-match
(get-char-code-property (string-to-char (match-string 0))
'iscii))))
'iscii)));; )
(point-max))))
(defun indian-iscii-to-ucs-region (from to)
@ -1246,7 +1246,7 @@ Returns new end position."
(interactive "r")
(save-excursion
(save-restriction
(let ((pos from)
(let (;; (pos from)
(alist (char-table-extra-slot indian-2-column-to-ucs-chartable 0)))
(narrow-to-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
(set-char-table-range
composition-function-table key
(list (vector (cdr slot) 0 'font-shape-gstring))))))
(list (vector (cdr slot) 0 #'font-shape-gstring))))))
char-script-table))
(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) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@ -236,7 +236,7 @@ of which charset is `japanese-jisx0201-kana'."
(composition
(and (not hankaku)
(get-char-code-property kana 'kana-composition)))
next slot)
slot) ;; next
(if (and composition (setq slot (assq (following-char) composition)))
(japanese-replace-region (match-beginning 0) (1+ (point))
(cdr slot))
@ -258,7 +258,7 @@ of which charset is `japanese-jisx0201-kana'."
(while (re-search-forward "\\cK\\|\\ck" nil t)
(let* ((kata (preceding-char))
(composition (get-char-code-property kata 'kana-composition))
next slot)
slot) ;; next
(if (and composition (setq slot (assq (following-char) composition)))
(japanese-replace-region (match-beginning 0) (1+ (point))
(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)))
(let* ((hankaku (preceding-char))
(composition (get-char-code-property hankaku 'kana-composition))
next slot)
slot) ;; next
(if (and composition (setq slot (assq (following-char) composition)))
(japanese-replace-region (match-beginning 0) (1+ (point))
(cdr slot))

View file

@ -31,7 +31,7 @@
(documentation . t)))
(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 '(#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, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@ -45,7 +45,7 @@
(activate-input-method
(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."
(interactive "i")
(and current-input-method
@ -54,7 +54,7 @@
default-korean-keyboard))
(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."
(interactive "i")
(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)))
(set-char-table-range composition-function-table
'(#x1100 . #x115F)
(list (vector pattern 0 'font-shape-gstring)))
(list (vector pattern 0 #'font-shape-gstring)))
(set-char-table-range composition-function-table
'(#xA960 . #xA97C)
(list (vector pattern 0 'font-shape-gstring))))
(list (vector pattern 0 #'font-shape-gstring))))
(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) 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)
(or (font-shape-gstring gstring direction)
(let ((glyph-len (lgstring-glyph-len gstring))
(i 0)
glyph)
(i 0)) ;; glyph
(while (and (< i glyph-len)
(setq glyph (lgstring-glyph gstring i)))
;; (setq glyph
(lgstring-glyph gstring i)) ;;)
(setq i (1+ i)))
(compose-glyph-string-relative gstring 0 i 0.1)))))

View file

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

View file

@ -137,9 +137,9 @@ thin (i.e. 1-dot width) space."
composition-function-table
'(#x600 . #x74F)
(list (vector "[\u200C\u200D][\u0600-\u074F\u200C\u200D]+"
1 'arabic-shape-gstring)
1 #'arabic-shape-gstring)
(vector "[\u0600-\u074F\u200C\u200D]+"
0 'arabic-shape-gstring)))
0 #'arabic-shape-gstring)))
;; The Egyptian Hieroglyph Format Controls were introduced in Unicode
;; 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
;; displayed individually, and not as a single
;; grapheme cluster.
1 'font-shape-gstring)))
1 #'font-shape-gstring)))
;; Grouping controls
(set-char-table-range
composition-function-table
#x13437
(list (vector "\U00013437[\U00013000-\U0001343F]+"
0 'egyptian-shape-grouping))))
0 #'egyptian-shape-grouping))))
(provide 'misc-lang)

View file

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

View file

@ -30,7 +30,7 @@
(set-char-table-range composition-function-table
'(#xAA80 . #xAADF)
'tai-viet-composition-function)
#'tai-viet-composition-function)
(set-language-info-alist
"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) 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))
(last-char (lgstring-char gstring
(1- (lgstring-char-len gstring))))
(i 0)
glyph)
(i 0)) ;; glyph
(while (and (< i glyph-len)
(setq glyph (lgstring-glyph gstring i)))
;; (setq glyph
(lgstring-glyph gstring i)) ;; )
(setq i (1+ i)))
(if (= last-char ?ำ)
(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
;; 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.
(let ((start (point))
(limit (match-end 0))
boundaries
tail)
boundaries) ;; tail
;; If thai-forward-word has been called within a Thai
;; region, we must go back until the Thai region starts
;; 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) 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)))
(apply 'concat (nreverse t-str-list))))
;;;
;;
;;; Functions for composing/decomposing Tibetan sequence.
;;;
;;; A Tibetan syllable is typically structured as follows:
;;;
;;; [Prefix] C [C+] V [M] [Suffix [Post suffix]]
;;;
;;; 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.
;;; (Sanskrit visarga, though it is a vowel modifier, is considered
;;; to be a punctuation.)
;;;
;;; Here are examples of the words "bsgrubs" and "hfauM"
;;;
;;; བསྒྲུབས ཧཱུཾ
;;;
;;; M
;;; b s b s h
;;; g fa
;;; r u
;;; u
;;;
;;; Consonants `'' (འ), `w' (ཝ), `y' (ཡ), `r' (ར) take special
;;; forms when they are used as subjoined consonant. Consonant `r'
;;; takes another special form when used as superjoined in such a case
;;; as "rka", while it does not change its form when conjoined with
;;; subjoined `'', `w' or `y' as in "rwa", "rya".
;;
;; A Tibetan syllable is typically structured as follows:
;;
;; [Prefix] C [C+] V [M] [Suffix [Post suffix]]
;;
;; 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.
;; (Sanskrit visarga, though it is a vowel modifier, is considered
;; to be a punctuation.)
;;
;; Here are examples of the words "bsgrubs" and "hfauM"
;;
;; བསྒྲུབས ཧཱུཾ
;;
;; M
;; b s b s h
;; g fa
;; r u
;; u
;;
;; Consonants `'' (འ), `w' (ཝ), `y' (ཡ), `r' (ར) take special
;; forms when they are used as subjoined consonant. Consonant `r'
;; takes another special form when used as superjoined in such a case
;; as "rka", while it does not change its form when conjoined with
;; subjoined `'', `w' or `y' as in "rwa", "rya".
;; Append a proper composition rule and glyph to COMPONENTS to compose
;; CHAR with a composition that has COMPONENTS.
; Append a proper composition rule and glyph to COMPONENTS to compose
; CHAR with a composition that has COMPONENTS.
(defun tibetan-add-components (components char)
(let ((last (last components))
(stack-upper '(tc . bc))
(stack-under '(bc . tc))
rule comp-vowel tmp)
rule comp-vowel)
;; Special treatment for 'a chung.
;; If 'a follows a consonant, turn it into the subjoined form.
;; * Disabled by Tomabechi 2000/06/09 *
@ -246,7 +246,7 @@ The returned string has no composition information."
(defun tibetan-compose-region (beg end)
"Compose Tibetan text the region BEG and END."
(interactive "r")
(let (str result chars)
;; (let (str result chars)
(save-excursion
(save-restriction
(narrow-to-region beg end)
@ -272,7 +272,7 @@ The returned string has no composition information."
(while (< (point) to)
(tibetan-add-components components (following-char))
(forward-char 1))
(compose-region from to components)))))))
(compose-region from to components)))))) ;; )
(defvar tibetan-decompose-precomposition-alist
(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.
(set-char-table-range
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)

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
;; National Institute of Advanced Industrial Science and Technology (AIST)
@ -128,7 +128,7 @@
;;;###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-match tai-viet-re string from)
(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) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,