all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to simulate keyboard input in self-defined function?
@ 2008-08-22 11:34 xiaopeng hu
  2008-09-01 16:40 ` Kevin Rodgers
  0 siblings, 1 reply; 6+ messages in thread
From: xiaopeng hu @ 2008-08-22 11:34 UTC (permalink / raw)
  To: help-gnu-emacs

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

I want to simulate keyboard input in a function.

How to do it?

How to find build-in functions about "simulate keyboard input"?

Thanks

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

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

* Re: How to simulate keyboard input in self-defined function?
       [not found] <mailman.17315.1219404871.18990.help-gnu-emacs@gnu.org>
@ 2008-08-22 16:55 ` Rupert Swarbrick
       [not found]   ` <ffe0539f0808221655u23b6393ak2f25709ae0e83c98@mail.gmail.com>
  2008-08-23 14:34   ` huxiaopengstat
  0 siblings, 2 replies; 6+ messages in thread
From: Rupert Swarbrick @ 2008-08-22 16:55 UTC (permalink / raw)
  To: help-gnu-emacs

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

"xiaopeng hu" <huxiaopengstat@gmail.com> writes:

> I want to simulate keyboard input in a function.
>
> How to do it?
>
> How to find build-in functions about "simulate keyboard input"?
>

Well, unless you want to work out how to do whatever you want to do all
by yourself, I recommend giving a little more information about what you
want.

Keyboard macros?

Rupert

[-- Attachment #2: Type: application/pgp-signature, Size: 314 bytes --]

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

* Re: How to simulate keyboard input in self-defined function?
       [not found]     ` <ffe0539f0808221700w3d29d898nfedc0218a31639bd@mail.gmail.com>
@ 2008-08-23  9:48       ` Rupert Swarbrick
  2008-08-23 14:44         ` huxiaopengstat
  0 siblings, 1 reply; 6+ messages in thread
From: Rupert Swarbrick @ 2008-08-23  9:48 UTC (permalink / raw)
  To: help-gnu-emacs

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

"xiaopeng hu" <huxiaopengstat@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" <huxiaopengstat@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 <huxiaopengstat@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.

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?

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

[-- Attachment #2: Type: application/pgp-signature, Size: 314 bytes --]

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

* Re: How to simulate keyboard input in self-defined function?
  2008-08-22 16:55 ` How to simulate keyboard input in self-defined function? Rupert Swarbrick
       [not found]   ` <ffe0539f0808221655u23b6393ak2f25709ae0e83c98@mail.gmail.com>
@ 2008-08-23 14:34   ` huxiaopengstat
  1 sibling, 0 replies; 6+ messages in thread
From: huxiaopengstat @ 2008-08-23 14:34 UTC (permalink / raw)
  To: help-gnu-emacs

On 8月23日, 上午12时55分, Rupert Swarbrick <rswarbr...@gmail.com> wrote:
> > I want to simulate keyboard input in a function.
>
> > How to do it?
>
> > How to find build-in functions about "simulate keyboard input"?
>
> Well, unless you want to work out how to do whatever you want to do all
> by yourself, I recommend giving a little more information about what you
> want.
>
> Keyboard macros?
>
> Rupert
>
>  application_pgp-signature_part
> < 1KViewDownload

I use gmail to use this forum. Below is my reply to above letter.

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?

I want emacs more intelligent in latex file.
Every strike input real charater.
Don't space many keystrike to toggle input method

Thanks


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

* Re: How to simulate keyboard input in self-defined function?
  2008-08-23  9:48       ` Rupert Swarbrick
@ 2008-08-23 14:44         ` huxiaopengstat
  0 siblings, 0 replies; 6+ messages in thread
From: huxiaopengstat @ 2008-08-23 14:44 UTC (permalink / raw)
  To: help-gnu-emacs

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



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

* Re: How to simulate keyboard input in self-defined function?
  2008-08-22 11:34 xiaopeng hu
@ 2008-09-01 16:40 ` Kevin Rodgers
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2008-09-01 16:40 UTC (permalink / raw)
  To: help-gnu-emacs

xiaopeng hu wrote:
> I want to simulate keyboard input in a function.
> 
> How to do it?
> 
> How to find build-in functions about "simulate keyboard input"?

Push characters onto unread-command-events (see the "Event Input Misc"
node of the Emacs Lisp manual).

-- 
Kevin Rodgers
Denver, Colorado, USA





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

end of thread, other threads:[~2008-09-01 16:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
2008-08-23 14:34   ` huxiaopengstat
2008-08-22 11:34 xiaopeng hu
2008-09-01 16:40 ` Kevin Rodgers

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.