From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "rgb" Newsgroups: gmane.emacs.help Subject: Re: Invoking electirc command programmatically Date: 10 May 2005 09:55:22 -0700 Organization: http://groups.google.com Message-ID: <1115744122.710558.267240@f14g2000cwb.googlegroups.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1115743946 28882 80.91.229.2 (10 May 2005 16:52:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 10 May 2005 16:52:26 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 10 18:52:24 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DVXxC-0005iC-1Q for geh-help-gnu-emacs@m.gmane.org; Tue, 10 May 2005 18:51:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DVY5l-0006wW-AO for geh-help-gnu-emacs@m.gmane.org; Tue, 10 May 2005 13:00:21 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 25 Original-NNTP-Posting-Host: 198.74.20.78 Original-X-Trace: posting.google.com 1115744127 30952 127.0.0.1 (10 May 2005 16:55:27 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 10 May 2005 16:55:27 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: f14g2000cwb.googlegroups.com; posting-host=198.74.20.78; posting-account=C7LM4w0AAAD23IRuMuUUJVCLQTuHhTK8 Original-Xref: shelby.stanford.edu gnu.emacs.help:130828 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:26485 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:26485 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.