diff options
Diffstat (limited to 'lisp/international')
-rw-r--r-- | lisp/international/characters.el | 2 | ||||
-rw-r--r-- | lisp/international/mule-cmds.el | 88 | ||||
-rw-r--r-- | lisp/international/mule.el | 3 | ||||
-rw-r--r-- | lisp/international/quail.el | 37 | ||||
-rw-r--r-- | lisp/international/robin.el | 6 |
5 files changed, 92 insertions, 44 deletions
diff --git a/lisp/international/characters.el b/lisp/international/characters.el index 9bce419b489..c643f66cbb0 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el @@ -265,7 +265,7 @@ with L, LRE, or LRO Unicode bidi character type.") (map-charset-chars #'modify-syntax-entry 'korean-ksc5601 "_" #x2121 #x227E) (map-charset-chars #'modify-syntax-entry 'korean-ksc5601 "_" #x2621 #x277E) (map-charset-chars #'modify-syntax-entry 'korean-ksc5601 "_" #x2830 #x287E) -(map-charset-chars #'modify-syntax-entry 'korean-ksc5601 "_" #x2930 #x297E) +(map-charset-chars #'modify-syntax-entry 'korean-ksc5601 "_" #x2930 #x2975) (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?A #x2330 #x2339) (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?A #x2341 #x235A) (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?A #x2361 #x237A) diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 8202c3ee27a..e4bdf50f526 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -1315,15 +1315,13 @@ Each function is called with one arg, LEIM directory name.") (dolist (function update-leim-list-functions) (apply function dirs))) -(defvar current-input-method nil +(defvar-local current-input-method nil "The current input method for multilingual text. If nil, that means no input method is activated now.") -(make-variable-buffer-local 'current-input-method) (put 'current-input-method 'permanent-local t) -(defvar current-input-method-title nil +(defvar-local current-input-method-title nil "Title string of the current input method shown in mode line.") -(make-variable-buffer-local 'current-input-method-title) (put 'current-input-method-title 'permanent-local t) (define-widget 'mule-input-method-string 'string @@ -1355,45 +1353,40 @@ This is the input method activated by the command :set-after '(current-language-environment) :version "28.1") -(defvar current-transient-input-method nil +(defvar-local current-transient-input-method nil "Current input method temporarily enabled by `activate-transient-input-method'. If nil, that means no transient input method is active now.") -(make-variable-buffer-local 'current-transient-input-method) (put 'current-transient-input-method 'permanent-local t) -(defvar previous-transient-input-method nil +(defvar-local previous-transient-input-method nil "The input method that was active before enabling the transient input method. If nil, that means no previous input method was active.") -(make-variable-buffer-local 'previous-transient-input-method) (put 'previous-transient-input-method 'permanent-local t) (put 'input-method-function 'permanent-local t) -(defvar input-method-history nil +(defvar-local input-method-history nil "History list of input methods read from the minibuffer. Maximum length of the history list is determined by the value of `history-length', which see.") -(make-variable-buffer-local 'input-method-history) (put 'input-method-history 'permanent-local t) (define-obsolete-variable-alias 'inactivate-current-input-method-function 'deactivate-current-input-method-function "24.3") -(defvar deactivate-current-input-method-function nil +(defvar-local deactivate-current-input-method-function nil "Function to call for deactivating the current input method. Every input method should set this to an appropriate value when activated. This function is called with no argument. This function should never change the value of `current-input-method'. It is set to nil by the function `deactivate-input-method'.") -(make-variable-buffer-local 'deactivate-current-input-method-function) (put 'deactivate-current-input-method-function 'permanent-local t) -(defvar describe-current-input-method-function nil +(defvar-local describe-current-input-method-function nil "Function to call for describing the current input method. This function is called with no argument.") -(make-variable-buffer-local 'describe-current-input-method-function) (put 'describe-current-input-method-function 'permanent-local t) (defvar input-method-alist nil @@ -3084,12 +3077,47 @@ on encoding." (puthash "BELL (BEL)" ?\a names) (setq ucs-names names)))) +(defun mule--ucs-names-sort-by-code (names) + (let ((codes-and-names + (mapcar (lambda (name) (cons (gethash name ucs-names) name)) names))) + (mapcar #'cdr (sort codes-and-names #'car-less-than-car)))) + (defun mule--ucs-names-affixation (names) (mapcar (lambda (name) (let ((char (gethash name ucs-names))) - (list name (concat (if char (format "%c" char) " ") "\t") ""))) + (list name (concat (if char (list char) " ") "\t") ""))) names)) +(defun mule--ucs-names-group (names) + (let* ((codes-and-names + (mapcar (lambda (name) (cons (gethash name ucs-names) name)) names)) + (grouped + (seq-group-by + (lambda (code-name) + (let ((script (aref char-script-table (car code-name)))) + (if script (symbol-name script) "ungrouped"))) + codes-and-names)) + names-with-header header) + (dolist (group (sort grouped (lambda (a b) (string< (car a) (car b))))) + (setq header t) + (dolist (code-name (cdr group)) + (push (list + (cdr code-name) + (concat + (if header + (progn + (setq header nil) + (concat "\n" (propertize + (format "* %s\n" (car group)) + 'face 'header-line))) + "") + ;; prefix + (if (car code-name) (format "%c" (car code-name)) " ") "\t") + ;; suffix + "") + names-with-header))) + (nreverse names-with-header))) + (defun char-from-name (string &optional ignore-case) "Return a character as a number from its Unicode name STRING. If optional IGNORE-CASE is non-nil, ignore case in STRING. @@ -3111,6 +3139,23 @@ Return nil if STRING does not name a character." ignore-case)) code))))))) +(defcustom read-char-by-name-sort nil + "How to sort characters for `read-char-by-name' completion. +Defines the sorting order either by character names or their codepoints." + :type '(choice + (const :tag "Sort by character names" nil) + (const :tag "Sort by character codepoints" code)) + :group 'mule + :version "28.1") + +(defcustom read-char-by-name-group nil + "How to group characters for `read-char-by-name' completion. +When t, split characters to sections of Unicode blocks +sorted alphabetically." + :type 'boolean + :group 'mule + :version "28.1") + (defun read-char-by-name (prompt) "Read a character by its Unicode name or hex number string. Display PROMPT and read a string that represents a character by its @@ -3124,6 +3169,9 @@ preceded by an asterisk `*' and use completion, it will show all the characters whose names include that substring, not necessarily at the beginning of the name. +The options `read-char-by-name-sort' and `read-char-by-name-group' +define the sorting order of completion characters and how to group them. + Accept a name like \"CIRCULATION FUNCTION\", a hexadecimal number like \"2A10\", or a number in hash notation (e.g., \"#x2a10\" for hex, \"10r10768\" for decimal, or \"#o25020\" for @@ -3137,8 +3185,14 @@ as names, not numbers." prompt (lambda (string pred action) (if (eq action 'metadata) - '(metadata - (affixation-function . mule--ucs-names-affixation) + `(metadata + (display-sort-function + . ,(when (eq read-char-by-name-sort 'code) + #'mule--ucs-names-sort-by-code)) + (affixation-function + . ,(if read-char-by-name-group + #'mule--ucs-names-group + #'mule--ucs-names-affixation)) (category . unicode-name)) (complete-with-action action (ucs-names) string pred))))) (char diff --git a/lisp/international/mule.el b/lisp/international/mule.el index dd4448d5604..91d18c34295 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -1192,12 +1192,11 @@ FORM is a form to evaluate to define the coding-system." ;; `last-coding-system-used'. (It used to set it unconditionally, but ;; that seems unnecessary; see Bug#4533.) -(defvar buffer-file-coding-system-explicit nil +(defvar-local buffer-file-coding-system-explicit nil "The file coding system explicitly specified for the current buffer. The value is a cons of coding systems for reading (decoding) and writing (encoding). Internal use only.") -(make-variable-buffer-local 'buffer-file-coding-system-explicit) (put 'buffer-file-coding-system-explicit 'permanent-local t) (defun read-buffer-file-coding-system () diff --git a/lisp/international/quail.el b/lisp/international/quail.el index 0901115cffe..67ea00665fc 100644 --- a/lisp/international/quail.el +++ b/lisp/international/quail.el @@ -61,15 +61,14 @@ ;; Buffer local variables -(defvar quail-current-package nil +(defvar-local quail-current-package nil "The current Quail package, which depends on the current input method. See the documentation of `quail-package-alist' for the format.") -(make-variable-buffer-local 'quail-current-package) (put 'quail-current-package 'permanent-local t) ;; Quail uses the following variables to assist users. ;; A string containing available key sequences or translation list. -(defvar quail-guidance-str nil) +(defvar-local quail-guidance-str nil) ;; A buffer to show completion list of the current key sequence. (defvar quail-completion-buf nil) ;; We may display the guidance string in a buffer on a one-line frame. @@ -78,41 +77,34 @@ See the documentation of `quail-package-alist' for the format.") ;; Each buffer in which Quail is activated should use different ;; guidance string. -(make-variable-buffer-local 'quail-guidance-str) (put 'quail-guidance-str 'permanent-local t) -(defvar quail-overlay nil +(defvar-local quail-overlay nil "Overlay which covers the current translation region of Quail.") -(make-variable-buffer-local 'quail-overlay) -(defvar quail-conv-overlay nil +(defvar-local quail-conv-overlay nil "Overlay which covers the text to be converted in Quail mode.") -(make-variable-buffer-local 'quail-conv-overlay) -(defvar quail-current-key nil +(defvar-local quail-current-key nil "Current key for translation in Quail mode.") -(make-variable-buffer-local 'quail-current-key) -(defvar quail-current-str nil +(defvar-local quail-current-str nil "Currently selected translation of the current key.") -(make-variable-buffer-local 'quail-current-str) -(defvar quail-current-translations nil +(defvar-local quail-current-translations nil "Cons of indices and vector of possible translations of the current key. Indices is a list of (CURRENT START END BLOCK BLOCKS), where CURRENT is an index of the current translation, START and END are indices of the start and end of the current block, BLOCK is the current block index, BLOCKS is a number of blocks of translation.") -(make-variable-buffer-local 'quail-current-translations) -(defvar quail-current-data nil +(defvar-local quail-current-data nil "Any Lisp object holding information of current translation status. When a key sequence is mapped to TRANS and TRANS is a cons of actual translation and some Lisp object to be referred for translating the longer key sequence, this variable is set to that Lisp object.") -(make-variable-buffer-local 'quail-current-data) ;; Quail package handlers. @@ -2027,10 +2019,15 @@ minibuffer and the selected frame has no other windows)." (bury-buffer quail-completion-buf) ;; Then, show the guidance. - (when (and (quail-require-guidance-buf) - (not input-method-use-echo-area) - (null unread-command-events) - (null unread-post-input-method-events)) + (when (and + ;; Don't try to display guidance on an expired minibuffer. This + ;; would go into an infinite wait rather than executing the user's + ;; command. Bug #45792. + (not (eq major-mode 'minibuffer-inactive-mode)) + (quail-require-guidance-buf) + (not input-method-use-echo-area) + (null unread-command-events) + (null unread-post-input-method-events)) (if (minibufferp) (if (eq (minibuffer-window) (frame-root-window)) ;; Use another frame. It is sure that we are using some diff --git a/lisp/international/robin.el b/lisp/international/robin.el index 55390df315f..e4a11801c38 100644 --- a/lisp/international/robin.el +++ b/lisp/international/robin.el @@ -371,14 +371,12 @@ Internal use only." ;;; Interactive use -(defvar robin-mode nil +(defvar-local robin-mode nil "If non-nil, `robin-input-method' is active.") -(make-variable-buffer-local 'robin-mode) -(defvar robin-current-package-name nil +(defvar-local robin-current-package-name nil "String representing the name of the current robin package. A nil value means no package is selected.") -(make-variable-buffer-local 'robin-current-package-name) ;;;###autoload (defun robin-use-package (name) |