all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to make emacs switch input method automatically ?
@ 2009-08-05 12:15 waterloo
  0 siblings, 0 replies; 4+ messages in thread
From: waterloo @ 2009-08-05 12:15 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 513 bytes --]

I use chinese to input normal text in latex .
And in math mode we almost use english .

I use `shift' to switch between chinese and english .

So now I use shift too frequently , my shift key is not sensitive .

How to make emacs switch  automatically ?

When  in math mode ,  emacs switchs to english .
When  in normal text ,emacs switchs to chinese.

Can here anyone  give some instructions of doing this ?

I know there is function `texmathp' in auctex which determines if point is
inside latex mode .

Thanks

[-- Attachment #2: Type: text/html, Size: 579 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to make emacs switch input method automatically ?
       [not found] <mailman.3938.1249474526.2239.help-gnu-emacs@gnu.org>
@ 2009-08-05 18:24 ` A.Politz
  0 siblings, 0 replies; 4+ messages in thread
From: A.Politz @ 2009-08-05 18:24 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 5, 2:15 pm, waterloo <waterloo2...@gmail.com> wrote:
> I use chinese to input normal text in latex .
> And in math mode we almost use english .
>
> I use `shift' to switch between chinese and english .
>
> So now I use shift too frequently , my shift key is not sensitive .
>
> How to make emacs switch  automatically ?
>
> When  in math mode ,  emacs switchs to english .
> When  in normal text ,emacs switchs to chinese.
>
> Can here anyone  give some instructions of doing this ?
>
> I know there is function `texmathp' in auctex which determines if point is
> inside latex mode .
>
> Thanks

Write a function, that does the job. In this case switching
between english (current-input-method = nil) and your preferred
method, depending on the circumstances.

(defun LaTeX-dynamic-input-method-toggle-maybe ()
  (when (or (and current-input-method
                 (texmathp))
            (and (not current-input-method)
                 (not (texmathp))))
    (toggle-input-method)))

Define a minor-mode, so this behaviour can be conviniently
enabled/disabled. The minor-mode puts the above function on the
`post-command-hook', so that the above function gets called
everytime you do something (e.g. move point).

(define-minor-mode LaTeX-dynamic-input-method
  "Dynamically disable input-method in math-mode."
  nil nil nil
  (if LaTeX-dynamic-input-method
      (add-hook 'post-command-hook 'LaTeX-dynamic-input-method-toggle-
maybe nil t)
    (remove-hook 'post-command-hook 'LaTeX-dynamic-input-method-toggle-
maybe t)))

Enable the mode in LaTeX-mode.
(add-hook 'LaTeX-mode-hook 'LaTeX-dynamic-input-method)

Sorry, I suck at explaining stuff, especially my own.

-ap


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to make emacs switch input method automatically ?
@ 2009-08-06  5:49 waterloo
  2009-08-06  6:13 ` Andy Stewart
  0 siblings, 1 reply; 4+ messages in thread
From: waterloo @ 2009-08-06  5:49 UTC (permalink / raw)
  To: help-gnu-emacs, politza

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

Thanks very much !

Now how to simulate `shift' key in elisp just like I stroke it ?

How to know the current input state ?

Below is my thought :
I use scim .  When I input chinese , It  use `space' to choose the first
character after I input `chinese pinyin'.
So if we simulate `k ' (k and a space) , when the character before point is
not `k '  I can know the current state is chinese. (This relate to character
code problem)

Is there any other better method?

Thanks again.

[-- Attachment #2: Type: text/html, Size: 548 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to make emacs switch input method automatically ?
  2009-08-06  5:49 How to make emacs switch input method automatically ? waterloo
@ 2009-08-06  6:13 ` Andy Stewart
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Stewart @ 2009-08-06  6:13 UTC (permalink / raw)
  To: help-gnu-emacs

waterloo <waterloo2005@gmail.com> writes:

> Thanks very much !
>
> Now how to simulate `shift' key in elisp just like I stroke it ?
>
> How to know the current input state ?
>
> Below is my thought :
> I use scim .  When I input chinese , It use `space' to choose the first character after I input
> chinese pinyin'.
> So if we simulate `k ' (k and a space) , when the character before point is not `k ' I can know the
> current state is chinese. (This relate to character
> code problem)
>
> Is there any other better method?
http://www.emacswiki.org/cgi-bin/emacs/ScimBridge_Chinese ?

  -- Andy





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-08-06  6:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-06  5:49 How to make emacs switch input method automatically ? waterloo
2009-08-06  6:13 ` Andy Stewart
     [not found] <mailman.3938.1249474526.2239.help-gnu-emacs@gnu.org>
2009-08-05 18:24 ` A.Politz
  -- strict thread matches above, loose matches on Subject: below --
2009-08-05 12:15 waterloo

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.