help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hook and interactive with parameter


From: tomas
Subject: Re: hook and interactive with parameter
Date: Mon, 12 Feb 2018 17:15:00 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

-----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-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]