From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nikolaj Schumacher Newsgroups: gmane.emacs.help Subject: Re: interactive function calls Date: Mon, 09 Jun 2008 18:46:27 +0200 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 1213030051 3969 80.91.229.12 (9 Jun 2008 16:47:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 Jun 2008 16:47:31 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Richard G Riley Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 09 18:48:14 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 1K5kXL-000790-Cu for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Jun 2008 18:48:03 +0200 Original-Received: from localhost ([127.0.0.1]:36771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5kWY-0005tA-76 for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Jun 2008 12:47:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K5kVs-0005hH-6F for help-gnu-emacs@gnu.org; Mon, 09 Jun 2008 12:46:32 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K5kVq-0005h3-MF for help-gnu-emacs@gnu.org; Mon, 09 Jun 2008 12:46:31 -0400 Original-Received: from [199.232.76.173] (port=39736 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5kVq-0005h0-G7 for help-gnu-emacs@gnu.org; Mon, 09 Jun 2008 12:46:30 -0400 Original-Received: from fmmailgate01.web.de ([217.72.192.221]:40773) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K5kVq-0004kn-4t for help-gnu-emacs@gnu.org; Mon, 09 Jun 2008 12:46:30 -0400 Original-Received: from smtp06.web.de (fmsmtp06.dlan.cinetic.de [172.20.5.172]) by fmmailgate01.web.de (Postfix) with ESMTP id 77B7DE36F1A6; Mon, 9 Jun 2008 18:46:28 +0200 (CEST) Original-Received: from [77.189.8.107] (helo=thursday) by smtp06.web.de with asmtp (WEB.DE 4.109 #226) id 1K5kVo-0007ph-00; Mon, 09 Jun 2008 18:46:28 +0200 In-Reply-To: (Richard G. Riley's message of "Mon\, 09 Jun 2008 11\:43\:13 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (darwin) X-Sender: n_schumacher@web.de X-Provags-ID: V01U2FsdGVkX1/pxKnQbiNMTr8WAo/nqaMXY0g2on/Hf4FWGLKf v/aMZgfWQ0GdxLVYykXD9plC56dSPvSOA2KAstY4IxMZXJ95/d iMGQZ7UY7utozq1hvSfQ== X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 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:54646 Archived-At: 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