From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Andreas_R=c3=b6hler?= Newsgroups: gmane.emacs.help Subject: Re: minor-mode hook not run Date: Fri, 23 Mar 2018 13:46:46 +0100 Message-ID: References: <2c3c91da-0f8e-cad2-1746-b3f7a66da98d@easy-emacs.de> <83fcbe37-e20f-a79c-bc00-01ff5c31225d@easy-emacs.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1521809106 29662 195.159.176.226 (23 Mar 2018 12:45:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 23 Mar 2018 12:45:06 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 23 13:45:02 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 1ezM46-0007ca-1t for geh-help-gnu-emacs@m.gmane.org; Fri, 23 Mar 2018 13:45:02 +0100 Original-Received: from localhost ([::1]:37914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezM69-000503-Cx for geh-help-gnu-emacs@m.gmane.org; Fri, 23 Mar 2018 08:47:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezM5m-0004zm-D9 for help-gnu-emacs@gnu.org; Fri, 23 Mar 2018 08:46:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezM5j-0001Rb-Ay for help-gnu-emacs@gnu.org; Fri, 23 Mar 2018 08:46:46 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.131]:35057) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ezM5j-0001Qb-0e for help-gnu-emacs@gnu.org; Fri, 23 Mar 2018 08:46:43 -0400 Original-Received: from [192.168.178.35] ([178.5.174.134]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.167]) with ESMTPSA (Nemesis) id 0Ljgrt-1eSVFR1UCn-00bweQ for ; Fri, 23 Mar 2018 13:46:40 +0100 In-Reply-To: Content-Language: en-US X-Provags-ID: V03:K0:AFAZscu8O369GK+f2sp0oBzJfW9pyFQTO4SaLU8KM5fgAxYcsQR 5Y8a9td4NXNGZL8pQvi06YKd/JNhhQwkbSKFqr0rGNEp1e52hkmJ64xVv6FxdCIzx6UBh9A XvBP6M8YkyKJR++xuP/93KxGKtepyMyZSVzmKytQj+o7UpbRJzpHiCHQeLWB0KJ3n7tqeTS NsnInYk5Pz4F4zt4YLJNQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:dgtR0IT/Gck=:hhx6UYI8HAkuWCPCLsrFqw sqmrutqJ6isXnf3yfxVoiLk8CvFLPyLeaW3QMWoN/U+Q8PLZhHOt56A+RMaYIbKJoQSfSP+ys qBr4+cx+3EmBiUx9W51jp9Bj3MDzFJqFucxVdvKCqL6IW6Ma9bwyhbrGyso4khdwQZCT48PVV e/8SsE5Im4pSRmuobWE1U3EdJwRH/6FFSd78H5+/9rcu4f0hv4A08y2IdDZcazPr/ia4NmZBj /7R8xw7Oe4VtE2+1Ea/FSQAG8cGpz7RdAhQPUbErMoo/btBB2YZwQkAJx2Ac0/yLbDJA/TvFc df2B3QSv2mliPTBMBo2pawGkuGp+BTvhkB8OkUlu4PbPd8ex6gV4pn7r1pQmEdEke4yeJ4ZgM amyv5UEHLFRvJBOTIE6Fg6rtMgWpIhlPBjTzUJRh0kxyBx+oYYJ7bBkYn7q0mLaL2dd5AAEXu GaehQ7dgy334Lk+REukyMjXGskySmt5E1zBcVBQaPydWN/fIuckFV5ryEIUiVUUWiyKK4p/W6 rCXzzvsDUkEwUhCJIuPn95z3Nl56HGPdaag462yB4AeH5Wvt6lSMzzXBsj0bfBKfQTUloQqwg IuB1bvoTGdKhienPaqG1A02vr8Pcig7xJfnHu2Q4+CUc04hJt85jzxbOucqAfmFtuRUj3/kGa 92oDJWNbaw/KDUM12rPol9Kaz6crXg47isSvGtbGmPZJJNeSHXVfEAOkioau6RgfrfnJl/CkF zCAvVlEHd6ZWbTh10DpuODUtY3U4VMBCt1g1yQymHaGKPj5GtZvlHAV3Occ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.131 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:116270 Archived-At: On 22.03.2018 14:52, Stefan Monnier wrote: >>>> (add-hook 'foo-mode-hook 'foo-load-abc nil t) >>> Adding elements to one's own hook here definitely deserve a "bug ugly >>> hack" comment explaining why you'd want to do it that way. >> Hmm, not sure if I understand that part. > > I'm saying that adding to -mode-hook from within the body of > -mode is weird. > > Instead of > > (define-minor-mode foo-mode > ... > (add-hook 'foo-mode-hook #'blabla nil t) > ...) > > why not do the more natural: > > (define-minor-mode foo-mode > ... > (blabla) > ...) > > The "big ugly hack" comment should explain why the `add-hook` version > is needed. > >> Purpose is a generic key for related commands: >> For example to start a REPL, haskell-mode calls >> ‘haskell-interactive-switch’, python.el calls ‘run-python’, >> python-mode.el ‘py-shell’ etc. >> >> Instead of remembering different keys and change them maybe at several >> locations, a unified command ‘gk-repl’ is provided, whose key-binding >> should DTRT in all modes. > > I don't see how this explains why you need to go through foo-mode-hook > rather than calling the function directly. > Okay, got it, thanks, Andreas