From: Nikolaj Schumacher <n_schumacher@web.de>
To: Richard G Riley <rileyrgdev@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: interactive function calls
Date: Mon, 09 Jun 2008 18:46:27 +0200 [thread overview]
Message-ID: <m2tzg2a74s.fsf@nschum.de> (raw)
In-Reply-To: <g2itvl$jad$1@registered.motzarella.org> (Richard G. Riley's message of "Mon\, 09 Jun 2008 11\:43\:13 +0200")
Richard G Riley <rileyrgdev@gmail.com> 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
next prev parent reply other threads:[~2008-06-09 16:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-09 9:43 interactive function calls Richard G Riley
2008-06-09 16:46 ` Nikolaj Schumacher [this message]
[not found] ` <mailman.12949.1213029992.18990.help-gnu-emacs@gnu.org>
2008-06-09 18:53 ` Richard G Riley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2tzg2a74s.fsf@nschum.de \
--to=n_schumacher@web.de \
--cc=help-gnu-emacs@gnu.org \
--cc=rileyrgdev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).