[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to simulate keyboard input in self-defined function?
From: |
address@hidden |
Subject: |
Re: How to simulate keyboard input in self-defined function? |
Date: |
Sat, 23 Aug 2008 07:44:43 -0700 (PDT) |
User-agent: |
G2/1.0 |
On 8月23日, 下午5时48分, Rupert Swarbrick <rswarbr...@gmail.com> wrote:
> "xiaopeng hu" <huxiaopengs...@gmail.com> writes:
>
> So, grumpy stuff first. There's a real reply below.
>
> - Please reply to posts in newsgroups to the groups themselves: there's
> no particular reason this had to go as a private email.
> - Please don't top-post.
>
> "xiaopeng hu" <huxiaopengs...@gmail.com> writes:
> > I want emacs more intelligent in latex file.
> > Every strike input real charater.
> > Don't space many keystrike to toggle input method
> > Thanks
>
> I'm sorry, but I don't actually understand what you mean here - could
> you be more specific?
>
>
>
> > 2008/8/23 xiaopeng hu <huxiaopengs...@gmail.com>
>
> > Thanks for your warm heart! I want to simulate keystrike "t" +
> > <space> (not simultaneously). If what I get is not "t ", I know
> > my input method is not english. Then I will simulate "Ctrl" once
> > to toggle input method between english and chinese.
>
> > Why I do this is that I want to define a function, which
> > automatically switch my input method to english when I in math
> > mode such as $...$, \[ ...\](in latex file), switch to chinese
> > when I out of math mode.
>
> > In my computer , I do use another efficient input method ,whic use
> > only "Ctrol" to switch between chinese and english.
>
> > Input method builded in emacs is poor.
>
> > I just don't know how to implement the function, using defined
> > function or hook?
>
> > Thanks
>
> I now see what you mean about simulating key strokes. I think this is
> very dependent on what other software you're using. Is this windows? And
> what is the software that's catching single CTRL keypresses and
> switching modes?
>
> You see, although I don't know this for sure, I suspect that when you're
> in "English Mode", if you hit "t" then " " on the keyboard, "t" then " "
> are sent to Emacs. Fine. But if this external software is in another
> mode (where it presumably does some clever stuff like composing
> characters), the Emacs process won't ever see the "t" and the " " and
> instead will see what it gets translated to.
>
Yes, You understanded me.
> Moreover, I suspect you won't actually have a way to change this input
> method from emacs either - how do you propose to send a message to the
> external program?
>
I am using a chinese input method from google in winxp.
When I input in any program, the input method will first receive my
input.
If that input stat is english , my program will get the english
charater.
If that input stat is chinese, google's input method will give me a
list to select,and then my
program will get the chinese chararter.
To switch between the english and chinese is to use only "Ctrl" key
once.
Thanks anyway!!!
> Now, I see two obvious ways forward from here, but bear in mind I don't
> use multiple input methods except occaisionally switching to German, so
> this might not be that useful:
>
> 1) Live with it. No, really, it doesn't seem like an easy problem to
> solve, the way you've got things set up.
>
> 2) Try out the inbuilt emacs input methods. I understand you believe
> them to be "poor", but can you explain exactly what's wrong? After
> all, if there is something really wrong and you haven't got them
> mis-configured I'm sure someone will want to fix them.
> If you do use inbuilt emacs modes, then you'll have access to elisp
> like (toggle-input-method) to switch between modes etc. and what you
> want with the $$ characters seems quite achievable.
>
> Hope this is of some help,
>
> Rupert
>
> application_pgp-signature_part
> < 1KViewDownload