From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Minor mode hook run when mode is deactivated? Date: Thu, 08 Oct 2020 01:15:06 +0200 Message-ID: <87d01tr5l1.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31264"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.5.5; emacs 27.1.50 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 08 01:16:21 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kQIfV-00081l-FK for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 08 Oct 2020 01:16:21 +0200 Original-Received: from localhost ([::1]:48774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQIfU-0005Jj-Dr for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 07 Oct 2020 19:16:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQIeS-0005JC-TH for help-gnu-emacs@gnu.org; Wed, 07 Oct 2020 19:15:18 -0400 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:58671) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQIeO-0005PW-UY for help-gnu-emacs@gnu.org; Wed, 07 Oct 2020 19:15:16 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 3ABFE6E4 for ; Wed, 7 Oct 2020 19:15:09 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 07 Oct 2020 19:15:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= from:to:subject:date:message-id:mime-version:content-type; s= fm1; bh=9abBHiqhyQF1ZYUOgVm5uKPdqTw2FDyNHgmZTIWweJA=; b=vbxzxqv6 xZ1fdLnNxtuP+DoZPb7gqfD0wNJWl4NDC2f3FQjd79ToAzZhlx0jShtr8UliL+Co ZcKSzw1xGHRcTAgzusIbQQiNKKWgdIE7uneb9k1erJj7Qh2AtmJ/fjrTRFvkY07I sfMjD6tBwOYeOa29t/TXhbYaDP9DJaNW3hiNjwln9Gm2PdzqsH6dbyCrH/1HpzNW Duf0YLTR+BEZCViK+POkLlkcLNsE0mfJypEVU7TE7BnqA7hQ9r1fpPYBGo3iE5p6 DTklb9bBacSv1WUqXr+VsNvLZREbH0Hisqa3L6S2Qx4Y5uMCJRqv29nDG7CT3kWx 14S67180fjPFRQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=9abBHiqhyQF1ZYUOgVm5uKPdqTw2F DyNHgmZTIWweJA=; b=hxOokwwJXXP4CNQ2SkUs1UPQAdjFMHuDq8gk4eEgr4L7a rZsCWt3aOKcGOF/NO2g5qk4avHbTKVrBMBo3yQCY7SMEcCYXSjQfh3dQxmkaNGOH uueROoo6JIKVlBcWvPMSdWlvwIu4qB3aehUz9PLTL/Hv5nHj/+X60UznWG0zuEHv uVBDt5UMgZuod5BSP0eRXdv2RPCJCO5X9+7Q4Yrdj1Om0VXdwXM4BvBTOm30buLh zpMe8jBabe0Qsp5439HPNfIKJERA0bv2Mf+eYtwxm6wooFw9j9q51ySOIZY/0bDY 7J9xpexPM3wBgn8eWrquTJmdb/biUJlbKZYoPLfgg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrgeejgddukecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfgfhvffufffkgggtsehttdertddtre dtnecuhfhrohhmpeflohhoshhtucfmrhgvmhgvrhhsuceojhhoohhsthhkrhgvmhgvrhhs sehfrghsthhmrghilhdrfhhmqeenucggtffrrghtthgvrhhnpeduueeftdetgfelkeehie fhgedtledvuedtvdevudektdeiffeihffgvdfhtddufeenucfkphepleehrdeltddrvddv gedrvddugeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehjohhoshhtkhhrvghmvghrshesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: from Swift.fastmail.com (ip5f5ae0d6.dynamic.kabel-deutschland.de [95.90.224.214]) by mail.messagingengine.com (Postfix) with ESMTPA id 5A9C23064674 for ; Wed, 7 Oct 2020 19:15:08 -0400 (EDT) Received-SPF: pass client-ip=64.147.123.25; envelope-from=joostkremers@fastmail.fm; helo=wout2-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/07 19:15:09 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:124367 Archived-At: Hi, I recently ran into a problem that was apparently caused by a minor mode hook being run when the mode is deactivated. Counter-intuitive as that may be (to me, at least), a quick look at the code for `define-minor-mode` seems to suggest that it's in fact correct. Is there a rationale behind this? I noticed in the code that there are actually two more hooks, `-on-hook` and `-off-hook`, which according to a comment in the code are there for backward compatibility only. Which suggests that someone at some point thought about these things and made a conscious decision to this effect. Which in turn makes me wonder what the rationale was for that decision. :-) Also, I haven't been able to find any info on this in the Elisp and Emacs manuals. Aren't minor modes supposed to be turned off? TIA -- Joost Kremers Life has its moments