From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: gentsquash Newsgroups: gmane.emacs.help Subject: Re: Interactive-form invoked with specified arg Date: Wed, 5 Jun 2013 10:18:11 -0700 (PDT) Message-ID: <07632cb9-0f46-4086-bfa2-5ea07bd87758@qz2g2000pbb.googlegroups.com> References: <037e0390-7e59-4239-bf31-1c7e55b269db@v2g2000yqa.googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1370454130 14340 80.91.229.3 (5 Jun 2013 17:42:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Jun 2013 17:42:10 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 05 19:42:11 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UkHis-00046e-NS for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Jun 2013 19:42:10 +0200 Original-Received: from localhost ([::1]:58865 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkHis-0003Oo-9n for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Jun 2013 13:42:10 -0400 X-Received: by 10.224.200.202 with SMTP id ex10mr19259351qab.8.1370452692159; Wed, 05 Jun 2013 10:18:12 -0700 (PDT) X-Received: by 10.182.242.68 with SMTP id wo4mr141187obc.28.1370452692101; Wed, 05 Jun 2013 10:18:12 -0700 (PDT) Original-Path: usenet.stanford.edu!ch1no1007178qab.0!news-out.google.com!10ni283qax.0!nntp.google.com!ch1no1007167qab.0!postnews.google.com!qz2g2000pbb.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Complaints-To: groups-abuse@google.com Injection-Info: qz2g2000pbb.googlegroups.com; posting-host=24.136.39.217; posting-account=LepcaQgAAACr4mTxtqQZ5RIS3kaWpFxN Original-NNTP-Posting-Host: 24.136.39.217 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:20.0) Gecko/20100101 Firefox/20.0,gzip(gfe) Injection-Date: Wed, 05 Jun 2013 17:18:12 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:199060 X-Mailman-Approved-At: Wed, 05 Jun 2013 13:41:51 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:91326 Archived-At: Making Stefan's solution a macro, I am now using this in my code: (defmacro invoke-with-typing (FORM &rest CHARS) "JK:05Jun2013: Executes FORM, which would normally prompt the user for input. Here, CHARS are characters sent to the form, as-if the user had typed them. USAGE: (invoke-with-typing (query-replace \"wierd\" \"STRANGE\") ?y ? n ?! ) will replace the first occurrence of \"wierd\", not the second, and all the remaining occurrences Note that FORM needs to be a form, rather than evaluate to a form." `(let ((unread-command-events ',CHARS)) ,FORM) ) --Jonathan