Use lexical-binding in all lisp/international files

* lisp/startup.el (keyboard-type): Make obsolete and lex-bound.

* admin/unidata/unidata-gen.el (unidata-gen-file)
(unidata-gen-charprop): Mark the generated files to use lexical binding.

* lisp/international/isearch-x.el: Use lexical-binding.
(junk-hist): Declare locally.

* lisp/international/iso-cvt.el:
* lisp/international/utf-7.el:
* lisp/international/robin.el:
* lisp/international/ogonek.el:
* lisp/international/latin1-disp.el:
* lisp/international/kkc.el:
* lisp/international/kinsoku.el:
* lisp/international/ja-dic-utl.el: Use lexical-binding.

* lisp/international/ja-dic-cnv.el: Use lexical-binding.
(skkdic-breakup-string): Remove unused var `kana-len`.

* lisp/international/latexenc.el: Use lexical-binding.
(tex-start-of-header): Declare.

* lisp/international/mule-diag.el: Use lexical-binding.
(list-character-sets): Remove unused var `pos`.
(list-character-sets-1): Remove unused vars `tail` and `charset`.
(list-charset-chars): Remove unused vars `chars` and `plane`.
(describe-coding-system): Remove unused var `extra-spec`.
(mule--print-opened): New var.
(print-fontset): Bind it.
(print-fontset-element): Use it instead of `print-opened`.

* lisp/international/quail.el: Use lexical-binding.
(quail-start-translation, quail-start-conversion):
Remove unused var `generated-events`.
(quail-help-insert-keymap-description): Use local dynbound var `the-keymap`.
This commit is contained in:
Stefan Monnier 2021-01-25 22:58:19 -05:00
parent 8f0a2c84b6
commit b4b6a26840
16 changed files with 69 additions and 56 deletions

View file

@ -1416,7 +1416,8 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)."
(or elt (user-error "Unknown output file: %s" basename))
(or noninteractive (message "Generating %s..." file))
(with-temp-file file
(insert ";; " copyright "
(insert ";;; " basename " -*- lexical-binding:t -*-
;; " copyright "
;; Generated from Unicode data files by unidata-gen.el.
;; The sources for this file are found in the admin/unidata/ directory in
;; the Emacs sources. The Unicode data files are used under the
@ -1451,7 +1452,8 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)."
(defun unidata-gen-charprop (&optional charprop-file)
(or charprop-file (setq charprop-file (pop command-line-args-left)))
(with-temp-file charprop-file
(insert ";; Automatically generated by unidata-gen.el.\n"
(insert ";; Automatically generated by unidata-gen.el."
" -*- lexical-binding: t -*-\n"
";; See the admin/unidata/ directory in the Emacs sources.\n")
(dolist (elt unidata-file-alist)
(dolist (proplist (cdr elt))

View file

@ -2133,6 +2133,8 @@ obsolete back in Emacs-23.1. The affected functions are:
make-obsolete, define-obsolete-function-alias, make-obsolete-variable,
define-obsolete-variable-alias.
** The variable 'keyboard-type' is obsolete and not dynamically scoped any more
* Lisp Changes in Emacs 28.1

View file

@ -1,4 +1,4 @@
;;; isearch-x.el --- extended isearch handling commands
;;; isearch-x.el --- extended isearch handling commands -*- lexical-binding: t; -*-
;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@ -67,7 +67,7 @@
;; Exit from recursive edit safely. Set in `after-change-functions'
;; by isearch-with-keyboard-coding.
(defun isearch-exit-recursive-edit (start end length)
(defun isearch-exit-recursive-edit (_start _end _length)
(interactive)
(throw 'exit nil))
@ -102,6 +102,7 @@
;;;###autoload
(defun isearch-process-search-multibyte-characters (last-char &optional count)
(defvar junk-hist)
(if (eq this-command 'isearch-printing-char)
(let ((overriding-terminal-local-map nil)
(prompt (isearch-message-prefix))

View file

@ -1,4 +1,4 @@
;;; iso-cvt.el --- translate ISO 8859-1 from/to various encodings -*- coding: utf-8 -*-
;;; iso-cvt.el --- translate ISO 8859-1 from/to various encodings -*- lexical-binding: t; -*-
;; This file was formerly called gm-lingo.el.
;; Copyright (C) 1993-1998, 2000-2021 Free Software Foundation, Inc.
@ -79,7 +79,7 @@
(point-max))))
;;;###autoload
(defun iso-spanish (from to &optional buffer)
(defun iso-spanish (from to &optional _buffer)
"Translate net conventions for Spanish to ISO 8859-1.
Translate the region between FROM and TO using the table
`iso-spanish-trans-tab'.
@ -121,7 +121,7 @@ and may translate too little.")
"Currently active translation table for German.")
;;;###autoload
(defun iso-german (from to &optional buffer)
(defun iso-german (from to &optional _buffer)
"Translate net conventions for German to ISO 8859-1.
Translate the region FROM and TO using the table
`iso-german-trans-tab'.
@ -194,7 +194,7 @@ Optional arg BUFFER is ignored (for use in `format-alist')."
"Translation table for translating ISO 8859-1 characters to TeX sequences.")
;;;###autoload
(defun iso-iso2tex (from to &optional buffer)
(defun iso-iso2tex (from to &optional _buffer)
"Translate ISO 8859-1 characters to TeX sequences.
Translate the region between FROM and TO using the table
`iso-iso2tex-trans-tab'.
@ -387,7 +387,7 @@ This table is not exhaustive (and due to TeX's power can never be).
It only contains commonly used sequences.")
;;;###autoload
(defun iso-tex2iso (from to &optional buffer)
(defun iso-tex2iso (from to &optional _buffer)
"Translate TeX sequences to ISO 8859-1 characters.
Translate the region between FROM and TO using the table
`iso-tex2iso-trans-tab'.
@ -646,7 +646,7 @@ It only contains commonly used sequences.")
"Translation table for translating ISO 8859-1 characters to German TeX.")
;;;###autoload
(defun iso-gtex2iso (from to &optional buffer)
(defun iso-gtex2iso (from to &optional _buffer)
"Translate German TeX sequences to ISO 8859-1 characters.
Translate the region between FROM and TO using the table
`iso-gtex2iso-trans-tab'.
@ -655,7 +655,7 @@ Optional arg BUFFER is ignored (for use in `format-alist')."
(iso-translate-conventions from to iso-gtex2iso-trans-tab))
;;;###autoload
(defun iso-iso2gtex (from to &optional buffer)
(defun iso-iso2gtex (from to &optional _buffer)
"Translate ISO 8859-1 characters to German TeX sequences.
Translate the region between FROM and TO using the table
`iso-iso2gtex-trans-tab'.
@ -674,7 +674,7 @@ Optional arg BUFFER is ignored (for use in `format-alist')."
"Translation table for translating ISO 8859-1 characters to Duden sequences.")
;;;###autoload
(defun iso-iso2duden (from to &optional buffer)
(defun iso-iso2duden (from to &optional _buffer)
"Translate ISO 8859-1 characters to Duden sequences.
Translate the region between FROM and TO using the table
`iso-iso2duden-trans-tab'.
@ -812,7 +812,7 @@ Optional arg BUFFER is ignored (for use in `format-alist')."
("ÿ" "ÿ")))
;;;###autoload
(defun iso-iso2sgml (from to &optional buffer)
(defun iso-iso2sgml (from to &optional _buffer)
"Translate ISO 8859-1 characters in the region to SGML entities.
Use entities from \"ISO 8879:1986//ENTITIES Added Latin 1//EN\".
Optional arg BUFFER is ignored (for use in `format-alist')."
@ -820,7 +820,7 @@ Optional arg BUFFER is ignored (for use in `format-alist')."
(iso-translate-conventions from to iso-iso2sgml-trans-tab))
;;;###autoload
(defun iso-sgml2iso (from to &optional buffer)
(defun iso-sgml2iso (from to &optional _buffer)
"Translate SGML entities in the region to ISO 8859-1 characters.
Use entities from \"ISO 8879:1986//ENTITIES Added Latin 1//EN\".
Optional arg BUFFER is ignored (for use in `format-alist')."
@ -828,13 +828,13 @@ Optional arg BUFFER is ignored (for use in `format-alist')."
(iso-translate-conventions from to iso-sgml2iso-trans-tab))
;;;###autoload
(defun iso-cvt-read-only (&rest ignore)
(defun iso-cvt-read-only (&rest _ignore)
"Warn that format is read-only."
(interactive)
(error "This format is read-only; specify another format for writing"))
;;;###autoload
(defun iso-cvt-write-only (&rest ignore)
(defun iso-cvt-write-only (&rest _ignore)
"Warn that format is write-only."
(interactive)
(error "This format is write-only"))

View file

@ -1,4 +1,4 @@
;;; ja-dic-cnv.el --- convert a Japanese dictionary (SKK-JISYO.L) to Emacs Lisp
;;; ja-dic-cnv.el --- convert a Japanese dictionary (SKK-JISYO.L) to Emacs Lisp -*- lexical-binding: t; -*-
;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
@ -96,7 +96,7 @@
("もく" "")
("ゆき" "")))
(defun skkdic-convert-postfix (skkbuf buf)
(defun skkdic-convert-postfix (_skkbuf buf)
(byte-compile-info "Processing POSTFIX entries" t)
(goto-char (point-min))
(with-current-buffer buf
@ -150,7 +150,7 @@
(defconst skkdic-prefix-list '(skkdic-prefix-list))
(defun skkdic-convert-prefix (skkbuf buf)
(defun skkdic-convert-prefix (_skkbuf buf)
(byte-compile-info "Processing PREFIX entries" t)
(goto-char (point-min))
(with-current-buffer buf
@ -209,7 +209,7 @@
(substring str from idx)
skkdic-word-list)))
(if (or (and (consp kana2-list)
(let ((kana-len (length kana))
(let (;; (kana-len (length kana))
kana2)
(catch 'skkdic-tag
(while kana2-list

View file

@ -1,4 +1,4 @@
;;; ja-dic-utl.el --- utilities for handling Japanese dictionary (SKK-JISYO.L)
;;; ja-dic-utl.el --- utilities for handling Japanese dictionary (SKK-JISYO.L) -*- lexical-binding: t; -*-
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
;; 2005, 2006, 2007, 2008, 2009, 2010, 2011

View file

@ -1,4 +1,4 @@
;;; kinsoku.el --- `Kinsoku' processing funcs
;;; kinsoku.el --- `Kinsoku' processing funcs -*- lexical-binding: t; -*-
;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,

View file

@ -1,4 +1,4 @@
;;; kkc.el --- Kana Kanji converter
;;; kkc.el --- Kana Kanji converter -*- lexical-binding: t; -*-
;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,

View file

@ -1,4 +1,4 @@
;;; latexenc.el --- guess correct coding system in LaTeX files -*-coding: utf-8 -*-
;;; latexenc.el --- guess correct coding system in LaTeX files -*- lexical-binding: t; -*-
;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
@ -109,6 +109,8 @@ Return nil if no matching input encoding can be found."
(defvar latexenc-dont-use-tex-guess-main-file-flag nil
"Non-nil means don't use tex-guessmain-file to find the coding system.")
(defvar tex-start-of-header)
;;;###autoload
(defun latexenc-find-file-coding-system (arg-list)
"Determine the coding system of a LaTeX file if it uses \"inputenc.sty\".

View file

@ -1,4 +1,4 @@
;;; latin1-disp.el --- display tables for other ISO 8859 on Latin-1 terminals -*-coding: utf-8;-*-
;;; latin1-disp.el --- display tables for other ISO 8859 on Latin-1 terminals -*- lexical-binding: t; -*-
;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
@ -86,8 +86,8 @@ use either \\[customize] or the function `latin1-display'."
:group 'latin1-display
:type 'boolean
:require 'latin1-disp
:initialize 'custom-initialize-default
:set (lambda (symbol value)
:initialize #'custom-initialize-default
:set (lambda (_symbol value)
(if value
(apply #'latin1-display latin1-display-sets)
(latin1-display))))
@ -186,7 +186,7 @@ character set."
'arabic-iso8859-6
(car (remq 'ascii (get-language-info language
'charset))))))
(map-charset-chars #'(lambda (range arg)
(map-charset-chars #'(lambda (range _arg)
(standard-display-default (car range) (cdr range)))
charset))
(sit-for 0))
@ -201,11 +201,10 @@ character set: `latin-2', `hebrew' etc."
(char (and info (decode-char (car (remq 'ascii info)) ?\ ))))
(and char (char-displayable-p char))))
(defun latin1-display-setup (set &optional force)
(defun latin1-display-setup (set &optional _force)
"Set up Latin-1 display for characters in the given SET.
SET must be a member of `latin1-display-sets'. Normally, check
whether a font for SET is available and don't set the display if it
is. If FORCE is non-nil, set up the display regardless."
whether a font for SET is available and don't set the display if it is."
(cond
((eq set 'latin-2)
(latin1-display-identities set)
@ -735,7 +734,7 @@ is. If FORCE is non-nil, set up the display regardless."
(sit-for 0))
;;;###autoload
(defcustom latin1-display-ucs-per-lynx nil
(defcustom latin1-display-ucs-per-lynx nil ;FIXME: Isn't this a minor mode?
"Set up Latin-1/ASCII display for Unicode characters.
This uses the transliterations of the Lynx browser. The display isn't
changed if the display can render Unicode characters.
@ -745,8 +744,8 @@ use either \\[customize] or the function `latin1-display'."
:group 'latin1-display
:type 'boolean
:require 'latin1-disp
:initialize 'custom-initialize-default
:set (lambda (symbol value)
:initialize #'custom-initialize-default
:set (lambda (_symbol value)
(if value
(latin1-display-ucs-per-lynx 1)
(latin1-display-ucs-per-lynx -1))))

View file

@ -1,4 +1,4 @@
;;; mule-diag.el --- show diagnosis of multilingual environment (Mule)
;;; mule-diag.el --- show diagnosis of multilingual environment (Mule) -*- lexical-binding: t; -*-
;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@ -86,8 +86,7 @@ but still shows the full information."
(indent-to 48)
(insert "| +--CHARS\n")
(let ((columns '(("CHARSET-NAME" . name) "\t\t\t\t\t"
("D CH FINAL-BYTE" . iso-spec)))
pos)
("D CH FINAL-BYTE" . iso-spec))))
(while columns
(if (stringp (car columns))
(insert (car columns))
@ -117,8 +116,8 @@ but still shows the full information."
SORT-KEY should be `name' or `iso-spec' (default `name')."
(or sort-key
(setq sort-key 'name))
(let ((tail charset-list)
charset-info-list supplementary-list charset sort-func)
(let (;; (tail charset-list)
charset-info-list supplementary-list sort-func)
(dolist (charset charset-list)
;; Generate a list that contains all information to display.
(let ((elt (list charset
@ -273,9 +272,9 @@ meanings of these arguments."
(setq tab-width 4)
(set-buffer-multibyte t)
(let ((dim (charset-dimension charset))
(chars (charset-chars charset))
;; (plane (charset-iso-graphic-plane charset))
(plane 1)
;; (chars (charset-chars charset))
;; (plane (charset-iso-graphic-plane charset))
;; (plane 1)
(range (plist-get (charset-plist charset) :code-space))
min max min2 max2)
(if (> dim 2)
@ -415,7 +414,8 @@ or provided just for backward compatibility." nil)))
(print-coding-system-briefly coding-system 'doc-string)
(let ((type (coding-system-type coding-system))
;; Fixme: use this
(extra-spec (coding-system-plist coding-system)))
;; (extra-spec (coding-system-plist coding-system))
)
(princ "Type: ")
(princ type)
(cond ((eq type 'undecided)
@ -858,6 +858,8 @@ The IGNORED argument is ignored."
(with-output-to-temp-buffer "*Help*"
(describe-font-internal font-info)))))
(defvar mule--print-opened)
(defun print-fontset-element (val)
;; VAL has this format:
;; ((REQUESTED-FONT-NAME OPENED-FONT-NAME ...) ...)
@ -915,7 +917,7 @@ The IGNORED argument is ignored."
(or adstyle "*") registry)))))
;; Insert opened font names (if any).
(if (and (boundp 'print-opened) (symbol-value 'print-opened))
(if (bound-and-true-p mule--print-opened)
(dolist (opened (cdr elt))
(insert "\n\t[" opened "]")))))))
@ -943,8 +945,9 @@ the current buffer."
" and [" (propertize "OPENED" 'face 'underline) "])")
(let* ((info (fontset-info fontset))
(default-info (char-table-extra-slot info 0))
(mule--print-opened print-opened)
start1 end1 start2 end2)
(describe-vector info 'print-fontset-element)
(describe-vector info #'print-fontset-element)
(when (char-table-range info nil)
;; The default of FONTSET is described.
(setq start1 (re-search-backward "^default"))
@ -956,7 +959,7 @@ the current buffer."
(when default-info
(insert "\n ---<fallback to the default fontset>---")
(put-text-property (line-beginning-position) (point) 'face 'highlight)
(describe-vector default-info 'print-fontset-element)
(describe-vector default-info #'print-fontset-element)
(when (char-table-range default-info nil)
;; The default of the default fontset is described.
(setq end2 (re-search-backward "^default"))

View file

@ -1,4 +1,4 @@
;;; ogonek.el --- change the encoding of Polish diacritics
;;; ogonek.el --- change the encoding of Polish diacritics -*- lexical-binding: t; -*-
;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.

View file

@ -1,4 +1,4 @@
;;; quail.el --- provides simple input method for multilingual text
;;; quail.el --- provides simple input method for multilingual text -*- lexical-binding: t; -*-
;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@ -1046,7 +1046,7 @@ the following annotation types are supported.
(quail-install-decode-map ',decode-map))))))
;;;###autoload
(defun quail-install-map (map &optional name)
(defun quail-install-map (map &optional _name)
"Install the Quail map MAP in the current Quail package.
Optional 2nd arg NAME, if non-nil, is a name of Quail package for
@ -1060,7 +1060,7 @@ The installed map can be referred by the function `quail-map'."
(setcar (cdr (cdr quail-current-package)) map))
;;;###autoload
(defun quail-install-decode-map (decode-map &optional name)
(defun quail-install-decode-map (decode-map &optional _name)
"Install the Quail decode map DECODE-MAP in the current Quail package.
Optional 2nd arg NAME, if non-nil, is a name of Quail package for
@ -1390,7 +1390,7 @@ Return the input string."
(let* ((echo-keystrokes 0)
(help-char nil)
(overriding-terminal-local-map (quail-translation-keymap))
(generated-events nil) ;FIXME: What is this?
;; (generated-events nil) ;FIXME: What is this?
(input-method-function nil)
(modified-p (buffer-modified-p))
last-command-event last-command this-command inhibit-record)
@ -1455,7 +1455,7 @@ Return the input string."
(let* ((echo-keystrokes 0)
(help-char nil)
(overriding-terminal-local-map (quail-conversion-keymap))
(generated-events nil) ;FIXME: What is this?
;; (generated-events nil) ;FIXME: What is this?
(input-method-function nil)
(modified-p (buffer-modified-p))
last-command-event last-command this-command inhibit-record)
@ -2452,7 +2452,7 @@ should be made by `quail-build-decode-map' (which see)."
(insert-char ?- single-trans-width)
(forward-line 1)
;; Insert the key-tran pairs.
(dotimes (row rows)
(dotimes (_ rows)
(let ((elt (pop single-list)))
(when elt
(move-to-column col)
@ -2625,12 +2625,14 @@ KEY BINDINGS FOR CONVERSION
(run-hooks 'temp-buffer-show-hook)))))
(defun quail-help-insert-keymap-description (keymap &optional header)
(defvar the-keymap)
(let ((pos1 (point))
(the-keymap keymap)
pos2)
(if header
(insert header))
(save-excursion
(insert (substitute-command-keys "\\{keymap}")))
(insert (substitute-command-keys "\\{the-keymap}")))
;; Skip headers "key bindings", etc.
(forward-line 3)
(setq pos2 (point))

View file

@ -1,4 +1,4 @@
;;; robin.el --- yet another input method (smaller than quail)
;;; robin.el --- yet another input method (smaller than quail) -*- lexical-binding: t; -*-
;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
;; National Institute of Advanced Industrial Science and Technology (AIST)

View file

@ -1,4 +1,4 @@
;;; utf-7.el --- utf-7 coding system
;;; utf-7.el --- utf-7 coding system -*- lexical-binding: t; -*-
;; Copyright (C) 2003-2021 Free Software Foundation, Inc.

View file

@ -320,6 +320,8 @@ early init file.")
This variable is used to define the proper function and keypad
keys for use under X. It is used in a fashion analogous to the
environment variable TERM.")
(make-obsolete-variable 'keyboard-type nil "28.1")
(internal-make-var-non-special 'keyboard-type)
(defvar window-setup-hook nil
"Normal hook run after loading init files and handling the command line.