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: Wed, 21 Mar 2018 12:57:18 +0100 Message-ID: <83fcbe37-e20f-a79c-bc00-01ff5c31225d@easy-emacs.de> References: <2c3c91da-0f8e-cad2-1746-b3f7a66da98d@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 1521634706 20113 195.159.176.226 (21 Mar 2018 12:18:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 21 Mar 2018 12:18:26 +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 Wed Mar 21 13:18:22 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 1eychC-00054u-A6 for geh-help-gnu-emacs@m.gmane.org; Wed, 21 Mar 2018 13:18:22 +0100 Original-Received: from localhost ([::1]:54293 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eycjF-0005Pk-GP for geh-help-gnu-emacs@m.gmane.org; Wed, 21 Mar 2018 08:20:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eycMq-00015J-Kk for help-gnu-emacs@gnu.org; Wed, 21 Mar 2018 07:57:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eycMo-0002Bo-2T for help-gnu-emacs@gnu.org; Wed, 21 Mar 2018 07:57:20 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.135]:39505) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eycMn-0002Af-Ou for help-gnu-emacs@gnu.org; Wed, 21 Mar 2018 07:57:17 -0400 Original-Received: from [192.168.178.35] ([178.8.44.232]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.167]) with ESMTPSA (Nemesis) id 0LtypG-1eYsYP0bDi-011PqC for ; Wed, 21 Mar 2018 12:57:15 +0100 In-Reply-To: Content-Language: en-US X-Provags-ID: V03:K0:uKtkzSGI9sCtUQjHMOyH0vgwY2B4jEci1dohCleXrBkxoyUGQ48 IIU82GmsR4e3KNqQpSn/foNDRjFdcIXBhr49wEuDUKmBrcPjwlpZVgNBPO8v5XCOnmmRJC8 c1s/5Wij6pRTslWedf4I1xCEY3g0HGZkMWzxrYT1nT9tGjjjGa1fWREZGkkfhHaZEtIqXHT 78/J73TA7ld4H3NyW8q5Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:JGerZbjJO6U=:vcCzmaF1uXzHgyFRcJM1m1 EB6v5R+GnUZbvnctI9f71MFm0d1wOb/lyXkb6N1BOTaBG6IIfbNn/EYB7svCryAF32bbKHDiK 91LW2uzga5kuTxHgBqlJFKWVBcnx6AufcTveRgpVxqKMJwLe6i9p/iOiAuo4TG/4tyS/S6E2g bNkzZf+xt5Np1Q0QkGs8dERnVRA8cw9hvHVwiSP/yb7Wgry0zLbO3peixd9CJo4WcQWV11Dzc xtqVz4pdza6jVZHZDTA5yyr62ert2NdP8xEb3eXvOCkUe1GRXIksLa13qk3T3lwqEIo9i2bO8 jcI4yBfRkYEmh2p+aUpcgA81rwcihgNPte3kPnP2JnitqsT4B6Pftk9EyhAt5+QSI9MIXm7t0 d5MyMDehQeDVyGhwZscAoxDQj6iYnMqrc8f2yaGCuJdQVGknqLY276nkbCvkaA482xVIzY2gN S5o2VzaiiIS1rKND24yGKj6Pi6swfMm7mVfZlT2IonRSQ3F4qfZvkXM+Nm/gkgDOA+y8KAIQR nNdAAVqkIpse/m1ZjEJMgbouLVZFviBd//q4nJnhm+SC8KvCYupnmW6a8BCnxMIl2CBO8faHP SlmjkgeTTrKIdPcw30/5q+zeapJxtLmK30y/JgNunFxwY+DBDEksjkJN3o2Yn/WcIMMD2s6fl /khjxZUf7t1BJTv7gq9/N0P9uCu6k/F6luRXR4CJJSOfyVjmzzRSmS4O0k7Tvj8qCCAKxI5LI wY3I4aobI0GQ4NAWzIoIxJ2wNMuJmFHBboXwanV8kiWFmNFimCXbHqeSZZw= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.135 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:116239 Archived-At: On 20.03.2018 21:31, Stefan Monnier wrote: >> (define-minor-mode foo > ^^^ > This should likely be `foo-mode`. > >> "Do something" nil " FOO"} > > Is the above } intended? No, it's a typo, sorry. > >> :keymap foo-map > > [ I strongly recommend not to use :keymap argument and just name your > minor mode map `-map`. ] > >> (cond >> ((eq major-mode 'abc) > > It's usually better to test (derived-mode-p 'abc). Okay, done. > >> (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. 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. For the audacious: https://github.com/andreas-roehler/general-key > > In any case, the minor mode `foo` will run `foo-hook` but not > `foo-mode-hook` (which would be run by the `foo-mode` minor mode). > That solved it, thanks all, Andreas