unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "huxiaopengstat@gmail.com" <huxiaopengstat@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to simulate keyboard input in self-defined function?
Date: Sat, 23 Aug 2008 07:44:43 -0700 (PDT)	[thread overview]
Message-ID: <1062ed36-2e3b-48f3-91ec-1f6e9edddb73@w1g2000prk.googlegroups.com> (raw)
In-Reply-To: g8omdl$4o1$1@news.albasani.net

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



  reply	other threads:[~2008-08-23 14:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.17315.1219404871.18990.help-gnu-emacs@gnu.org>
2008-08-22 16:55 ` How to simulate keyboard input in self-defined function? Rupert Swarbrick
     [not found]   ` <ffe0539f0808221655u23b6393ak2f25709ae0e83c98@mail.gmail.com>
     [not found]     ` <ffe0539f0808221700w3d29d898nfedc0218a31639bd@mail.gmail.com>
2008-08-23  9:48       ` Rupert Swarbrick
2008-08-23 14:44         ` huxiaopengstat [this message]
2008-08-23 14:34   ` huxiaopengstat
2008-08-22 11:34 xiaopeng hu
2008-09-01 16:40 ` Kevin Rodgers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1062ed36-2e3b-48f3-91ec-1f6e9edddb73@w1g2000prk.googlegroups.com \
    --to=huxiaopengstat@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).