From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: hook and interactive with parameter Date: Mon, 12 Feb 2018 17:15:00 +0100 Message-ID: <20180212161500.GB3408@tuxteam.de> References: <86tvumgrbk.fsf@zoho.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; x-action=pgp-signed Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1518452824 6908 195.159.176.226 (12 Feb 2018 16:27:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Feb 2018 16:27:04 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Feb 12 17:27:00 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elGw4-0008AS-Jl for geh-help-gnu-emacs@m.gmane.org; Mon, 12 Feb 2018 17:26:32 +0100 Original-Received: from localhost ([::1]:48891 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elGy4-0004As-JG for geh-help-gnu-emacs@m.gmane.org; Mon, 12 Feb 2018 11:28:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elGl6-0001hz-Gl for help-gnu-emacs@gnu.org; Mon, 12 Feb 2018 11:15:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elGl2-0000CB-Oc for help-gnu-emacs@gnu.org; Mon, 12 Feb 2018 11:15:12 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:60118) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1elGl2-0008VS-EJ for help-gnu-emacs@gnu.org; Mon, 12 Feb 2018 11:15:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=20171004; h=From:In-Reply-To:Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID:Subject:To:Date; bh=HH46PV7Y8nfCIUStls1mpdMvf26lqL5/z9j279+SQA4=; b=eNgSA+VJUDr599gs6PFowbdCPw0awXlxctK7idGe8i6ltTyLVEwRJqSffeHsnzEv/sPJ0wqumDuw4DmtkM1QXg5G558sM1rMf0bPCpEKXChZjTyXBI8eoPtCW5t+FC7X292FWmQYq+8Z+5Ne+2b4Q4kbLGuboAburJ5sgownSgw0be04RKrZhgA1gAFQtd/KVekENRZlHnVs/BGcbbpiLjrlvxoylLtDnLN+90WFlAXfGyTcF8SkZIpkTTZ95LmqLVfi55e60RVt+GAtfxF4SZx9n1d+9u8qXUMVslesdZBo/0NPApknpYYJ/C7QNHavmcQ+qwMW9ojLUk0Ry8nAzQ==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1elGku-0001dc-G9 for help-gnu-emacs@gnu.org; Mon, 12 Feb 2018 17:15:00 +0100 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 5.199.139.25 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:115956 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Mon, Feb 12, 2018 at 04:43:04PM +0100, Lajos Bodnar wrote: > Thanks for your advice. > I would like to write a function which run up if I open a haskell file. > This function will ask a question automaticaly about that i would like to > run the intero-mode or not. Note that the `interactive' form is just "declarative", i.e. it doesn't "do" anything on itself. It just states what kind of parameters a function is going to take when invoked "as a command", that is, from a key binding or similar. The "magic" of asking for parameters happens there. When that function is invoked from a hook this "magic" will be missing :-) Besides, most hook functions are parameterless. One way around it is asking the user actively. See for example the function "read-from-minibuffer" (and perhaps most of the chapter on minibuffers from the Emacs manual). That said, to me, calling user interaction from a hook "feels" a bit strange. But perhaps it's just me. Cheers - -- tomás -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlqBvYQACgkQBcgs9XrR2kZveQCdHQG9Biu3wDCIhUpauInMsnQc HTIAnil7u+iufFKdB/zDKpFjj1jtL6/6 =r1CJ -----END PGP SIGNATURE-----