all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Invoking electirc command programmatically
@ 2005-05-10 14:48 PT
  2005-05-10 16:55 ` rgb
  2005-05-10 22:36 ` Tim X
  0 siblings, 2 replies; 3+ messages in thread
From: PT @ 2005-05-10 14:48 UTC (permalink / raw)


I have this electric function which inserts the character it is bound to  
and does something else too.

(defun my-electric-character (&optional arg)
   "Insert the typed character and pop up a completion buffer"
   (interactive "P")
   (self-insert-command (prefix-numeric-value arg))
   ...)

How can I invoke this function from my program with a certain character,  
so that it behaves just like if the user typed the character on the  
keyboard?

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

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

* Re: Invoking electirc command programmatically
  2005-05-10 14:48 Invoking electirc command programmatically PT
@ 2005-05-10 16:55 ` rgb
  2005-05-10 22:36 ` Tim X
  1 sibling, 0 replies; 3+ messages in thread
From: rgb @ 2005-05-10 16:55 UTC (permalink / raw)



PT wrote:
> I have this electric function which inserts the character it is bound
to
> and does something else too.
>
> (defun my-electric-character (&optional arg)
>    "Insert the typed character and pop up a completion buffer"
>    (interactive "P")
>    (self-insert-command (prefix-numeric-value arg))
>    ...)
>
> How can I invoke this function from my program with a certain
character,
> so that it behaves just like if the user typed the character on the
> keyboard?
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

I believe you want to set last-command-event before calling
my-electric-character.  I don't know where/if it's documented
but experience shows self-insert-command inserts the value
it finds in last-command-event.

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

* Re: Invoking electirc command programmatically
  2005-05-10 14:48 Invoking electirc command programmatically PT
  2005-05-10 16:55 ` rgb
@ 2005-05-10 22:36 ` Tim X
  1 sibling, 0 replies; 3+ messages in thread
From: Tim X @ 2005-05-10 22:36 UTC (permalink / raw)


PT <mailshield.gg@mailnull.com> writes:

> I have this electric function which inserts the character it is bound
> to  and does something else too.
>
> (defun my-electric-character (&optional arg)
>    "Insert the typed character and pop up a completion buffer"
>    (interactive "P")
>    (self-insert-command (prefix-numeric-value arg))
>    ...)
>
> How can I invoke this function from my program with a certain
> character,  so that it behaves just like if the user typed the
> character on the  keyboard?
>
> -- 
> Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

See abbrevs in the manual - I think its under autotyping or something
similar. It will allow you to define an abbrev for a character which
causes a certain function to be called anytime the user hits that
character. A number of standard modes use this technique.

Tim

-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!

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

end of thread, other threads:[~2005-05-10 22:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-10 14:48 Invoking electirc command programmatically PT
2005-05-10 16:55 ` rgb
2005-05-10 22:36 ` Tim X

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.