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: Tue, 13 Feb 2018 09:51:49 +0100 Message-ID: <20180213085148.GB29216@tuxteam.de> References: <86tvumgrbk.fsf@zoho.com> <86lgfygoux.fsf@zoho.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; x-action=pgp-signed X-Trace: blaine.gmane.org 1518511841 31970 195.159.176.226 (13 Feb 2018 08:50:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 13 Feb 2018 08:50:41 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) Cc: help-gnu-emacs@gnu.org, Emanuel Berg To: Lajos Bodnar Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 13 09:50:37 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 1elWID-0007Nu-IC for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Feb 2018 09:50:25 +0100 Original-Received: from localhost ([::1]:57336 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elWKF-0002u3-Dr for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Feb 2018 03:52:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elWJe-0002tX-Nn for help-gnu-emacs@gnu.org; Tue, 13 Feb 2018 03:51:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elWJb-0008Ty-M7 for help-gnu-emacs@gnu.org; Tue, 13 Feb 2018 03:51:54 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:33912) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1elWJb-0008Sz-9b for help-gnu-emacs@gnu.org; Tue, 13 Feb 2018 03:51:51 -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-Type:MIME-Version:References:Message-ID:Subject:Cc:To:Date; bh=XsQrzscb2KAJiIdCOxcKOk7YY1uWBM2so29U9qHChSI=; b=YJ883hs8kp+MdvUkh/eH3QNll+IxlG9jOxd6a6BJcs9WIcu2Nswz7C/JHtO4PuZAATELnLexaw1gi9DT50IwR98rM/pEHAkEJr15751DDnBgxqINBhk1nByP/Ebv6CrT6GZoD36TkUQDCUMLZqAKB6cpwXMTSu6VlzpCJlbRxnANd9A4uRVV/iMuvCJtqxFBkrb2FbbnHEhy2WgzEN78wJq7+bEaxNnNANkJBRUwz4SFXRIw41ev8BrN+9aC2WB+jreT1Y7jov5HFyfVuqzvu+E4O+fx4ruJ85ksFpfgbWLzxZOjRD34kOf8vSPO1nQCACU9CHWCs0TQYrmQXuGcaA==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1elWJZ-00082M-3G; Tue, 13 Feb 2018 09:51:49 +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:115965 Archived-At: -----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-----