From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard G Riley Newsgroups: gmane.emacs.help Subject: Re: interactive function calls Date: Mon, 09 Jun 2008 20:53:32 +0200 Organization: A noiseless patient Spider Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1213040440 13566 80.91.229.12 (9 Jun 2008 19:40:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 Jun 2008 19:40:40 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 09 21:41:23 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K5nF3-0003F6-Lv for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Jun 2008 21:41:21 +0200 Original-Received: from localhost ([127.0.0.1]:55353 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5nEG-0000hK-BM for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Jun 2008 15:40:32 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!feeder.erje.net!news.motzarella.org!motzarella.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 59 Original-X-Trace: feeder.motzarella.org U2FsdGVkX193ZVdHoDq2NRtqLbrx+ucpFmxyhz8UjDPJqLyIkCtCxan1ykwImzEgvTs7B40/4xE3zCGAd3xJa2yrNag2jpjXUOwSYBZo0PzZZAp+U8BmNXWk5CXgHR4iamjKaaG52Ho93l4MjAlCjg== Original-X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers Original-NNTP-Posting-Date: Mon, 9 Jun 2008 18:53:33 +0000 (UTC) X-Auth-Sender: U2FsdGVkX19k40hncGPsIzQwhWdWeKzkiumfgCWzkYxyzmgKaDuDIA== Cancel-Lock: sha1:B7OzPmbVt0r9qWT33m1PNsPYeyk= User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux) Original-Xref: news.stanford.edu gnu.emacs.help:159292 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:54649 Archived-At: Nikolaj Schumacher writes: > Richard G Riley wrote: > >> I have this in my .emacs >> >> (define-key mode-specific-map [?F] 'fortune-from-region) >> >> The problem is that in the code for fortune-append we see something >> like: >> >> ,---- >> | (unless interactive >> | (save-buffer) >> | (if fortune-always-compile >> | (fortune-compile file))))) >> | >> `---- >> >> Following a chat on #emacs on irc, I tried creating my own rgrfortune >> function which was then called from the key binding and then I was told >> it would call 'fortune-from-region "non interactively" - but this did not >> work > > From reading the code I gather that `interactive' in the code has > nothing to do with whether it is called interactively. Rather, > `interactive' is an argument that is set to t by `fortune-from-region', > regardless if called interactively or not. > > Here's the line from `fortune-from-region': > > (fortune-append string t file) > ^ > > So, working around that is not that easy. > >> The reason I want it called "non interactive" is simply that thats >> the way to save and compile the fortune file as the fortune-append >> snippet above shows. > > If I understand you correctly, couldn't you just call those lines > yourself? Something like this... > > (defun rgrfortune (beg end file) > (interactive (list (region-beginning) (region-end) > (if current-prefix-arg (fortune-ask-file)))) > (fortune-from-region beg end file) > (save-buffer) > (fortune-compile file)) > > > regards, > Nikolaj Schumacher Aargh. I misread the code there. I was convinced it was something to do with the interactive nature of calling code from a key bind. Thanks - that worked fine.