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: Tue, 13 Feb 2018 09:51:49 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Feb 13, 2018 at 09:23:41AM +0100, Lajos Bodnar wrote:
> Thanks a lot,
> I understood what the problem is with this concept.
> What is your advice ?
> The problem is that if I open a haskell file then sometimes I don't want to
> run intero-mode with it (because the intero mode is very expensive).
> In most cases I would like to run intero but not all time.

I'd go with experimenting. After all, a diffuse feeling by
Emanuel and me is less worth than hard-nosed experience :-)

So hook away, and either use yes-or-no-p (or its less verbose
sister y-or-n-p), as Emanuel suggested -- or the more complex
(but better tunable) minibuffer stuff. Find out what breaks
(if at all: hunches are, after all, just... hunches :)

Just to get you jumpsterted: this seems to work, more or less.
Fine tuning is left as an exercise for the reader :)

  (defun my-confirm-extra-toppings ()
    (when (y-or-n-p "With extra toppings? ")
      ;; just to show something:
      (set-background-color "lightblue")))
  
  (add-hook 'find-file-hook 'my-confirm-extra-toppings)

Enjoy :-)

Cheers
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlqCpyQACgkQBcgs9XrR2kaltACeMLATdhMYn8fFK/0H7FDUhL7m
Q9oAnRN/fm0o/AH9lRGHr6GJOSE18Bke
=Hrn/
-----END PGP SIGNATURE-----



reply via email to

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