mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 10:27:41 +00:00
Transient input methods bound to 'C-x \' (bug#44266)
* lisp/international/mule-cmds.el (ctl-x-map): Bind 'C-x \' to 'transient-input-method'. (input-method-function): New defcustom. (transient-input-method): New command. * doc/emacs/mule.texi (Select Input Method): Document transient-input-method.
This commit is contained in:
parent
1a1019f99f
commit
030ab2dad5
3 changed files with 72 additions and 8 deletions
|
|
@ -578,6 +578,11 @@ Enable or disable use of the selected input method (@code{toggle-input-method}).
|
|||
@item C-x @key{RET} C-\ @var{method} @key{RET}
|
||||
Select a new input method for the current buffer (@code{set-input-method}).
|
||||
|
||||
@item C-x \ @var{method} @key{RET}
|
||||
Temporarily enable the selected transient input method, and
|
||||
automatically disable it after inserting a single character
|
||||
(@code{transient-input-method}).
|
||||
|
||||
@item C-h I @var{method} @key{RET}
|
||||
@itemx C-h C-\ @var{method} @key{RET}
|
||||
@findex describe-input-method
|
||||
|
|
@ -675,6 +680,16 @@ character.
|
|||
input methods. The list gives information about each input method,
|
||||
including the string that stands for it in the mode line.
|
||||
|
||||
@findex transient-input-method
|
||||
@kindex C-x \
|
||||
To insert only a single character using a transient input method you
|
||||
can first select a transient input method by typing @kbd{C-u C-x \}.
|
||||
Then typing @kbd{C-x \} (@code{transient-input-method}) will
|
||||
temporarily enable the selected transient input method, and disable it
|
||||
automatically after using the activated input method to insert
|
||||
a single character. This is useful to insert a character from input
|
||||
methods with rare Unicode characters.
|
||||
|
||||
@node Coding Systems
|
||||
@section Coding Systems
|
||||
@cindex coding systems
|
||||
|
|
|
|||
25
etc/NEWS
25
etc/NEWS
|
|
@ -132,14 +132,6 @@ Emacs to break lines after more characters than just whitespace
|
|||
characters. In particular, this significantly improves word-wrapping
|
||||
for CJK text mixed with Latin text.
|
||||
|
||||
---
|
||||
** New input method 'compose' based on X Multi_key sequences.
|
||||
|
||||
---
|
||||
** Improved language transliteration in Malayalam input methods.
|
||||
Added a new Mozhi scheme. The inapplicable ITRANS scheme is now
|
||||
deprecated. Errors in the Inscript method were corrected.
|
||||
|
||||
---
|
||||
** Rudimentary support for the 'st' terminal emulator.
|
||||
Emacs now supports 256 color display on the 'st' terminal emulator.
|
||||
|
|
@ -629,6 +621,23 @@ recorded for the purpose of 'view-lossage'.
|
|||
The menu bar "Help" menu now has a "Show Recent Inputs" item under the
|
||||
"Describe" sub-menu.
|
||||
|
||||
** Input methods
|
||||
|
||||
+++
|
||||
*** 'C-x \' temporarily enables a transient input method.
|
||||
'C-u C-x \' can be used to select a transient input method, e.g.
|
||||
'C-u C-x \ compose RET' selects the 'compose' input method. Then typing
|
||||
'C-x \ 1 2' will insert the character '½', and disable the input method
|
||||
afterwards.
|
||||
|
||||
---
|
||||
*** New input method 'compose' based on X Multi_key sequences.
|
||||
|
||||
---
|
||||
*** Improved language transliteration in Malayalam input methods.
|
||||
Added a new Mozhi scheme. The inapplicable ITRANS scheme is now
|
||||
deprecated. Errors in the Inscript method were corrected.
|
||||
|
||||
** Ispell
|
||||
|
||||
+++
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
|
||||
;; Keep "C-x C-m ..." for mule specific commands.
|
||||
(define-key ctl-x-map "\C-m" mule-keymap)
|
||||
(define-key ctl-x-map "\\" 'transient-input-method)
|
||||
|
||||
(defvar describe-language-environment-map
|
||||
(let ((map (make-sparse-keymap "Describe Language Environment")))
|
||||
|
|
@ -1344,6 +1345,16 @@ This is the input method activated automatically by the command
|
|||
mule-input-method-string)
|
||||
:set-after '(current-language-environment))
|
||||
|
||||
(defcustom transient-input-method nil
|
||||
"Default transient input method.
|
||||
This is the input method activated automatically by the command
|
||||
`transient-input-method' (\\[transient-input-method])."
|
||||
:link '(custom-manual "(emacs)Input Methods")
|
||||
:group 'mule
|
||||
:type '(choice (const nil)
|
||||
mule-input-method-string)
|
||||
:set-after '(current-language-environment))
|
||||
|
||||
(put 'input-method-function 'permanent-local t)
|
||||
|
||||
(defvar input-method-history nil
|
||||
|
|
@ -1519,6 +1530,35 @@ To deactivate it programmatically, use `deactivate-input-method'."
|
|||
(defvar toggle-input-method-active nil
|
||||
"Non-nil inside `toggle-input-method'.")
|
||||
|
||||
(defun transient-input-method (&optional arg interactive)
|
||||
"Enable transient input method for the current buffer."
|
||||
(interactive "P\np")
|
||||
(when (or arg (not transient-input-method))
|
||||
(let* ((default (or (car input-method-history) default-input-method))
|
||||
(input-method
|
||||
(read-input-method-name
|
||||
(if default "Transient input method (default %s): " "Transient input method: ")
|
||||
default t)))
|
||||
(setq transient-input-method input-method)
|
||||
(when interactive
|
||||
(customize-mark-as-set 'transient-input-method))))
|
||||
(let* ((previous-input-method current-input-method)
|
||||
(history input-method-history)
|
||||
(clearfun (make-symbol "clear-transient-input-method"))
|
||||
(exitfun
|
||||
(lambda ()
|
||||
(deactivate-input-method)
|
||||
(when previous-input-method
|
||||
(activate-input-method previous-input-method))
|
||||
(setq input-method-history history)
|
||||
(remove-hook 'input-method-after-insert-chunk-hook clearfun))))
|
||||
(fset clearfun (lambda () (funcall exitfun)))
|
||||
(add-hook 'input-method-after-insert-chunk-hook clearfun)
|
||||
(when previous-input-method
|
||||
(deactivate-input-method))
|
||||
(activate-input-method transient-input-method)
|
||||
exitfun))
|
||||
|
||||
(defun toggle-input-method (&optional arg interactive)
|
||||
"Enable or disable multilingual text input method for the current buffer.
|
||||
Only one input method can be enabled at any time in a given buffer.
|
||||
|
|
|
|||
Loading…
Reference in a new issue