From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joel Reicher Newsgroups: gmane.emacs.help Subject: Re: Functions which are mode dependent Date: Fri, 23 Aug 2024 20:05:33 +1000 Message-ID: <86o75jh7v6.fsf@gmail.com> References: <-filg9QhoC3CircwDLuohUP6UvZ1KWTo7eUWUvUyQyLB9vi-ZpPKCdQS540lVRBny0N_OAkYOJeBYaOIa6sssmDBib5qdQmc_Ofs-GZR1yc=@protonmail.com> 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="25208"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Heime via Users list for the GNU Emacs text editor To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 23 12:06:11 2024 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 1shRBL-0006OL-DC for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 23 Aug 2024 12:06:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shRAs-00051h-2W; Fri, 23 Aug 2024 06:05:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1shRAq-00051Z-QV for help-gnu-emacs@gnu.org; Fri, 23 Aug 2024 06:05:40 -0400 Original-Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shRAp-00073z-5v for help-gnu-emacs@gnu.org; Fri, 23 Aug 2024 06:05:40 -0400 Original-Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-2702ed1056bso1357132fac.3 for ; Fri, 23 Aug 2024 03:05:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724407537; x=1725012337; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=Yfjc6Gylvc1PhWnM9PVay5A/GfkR5Ub+Qyrfk3kk32M=; b=ZjCt3xp2X1BSCd1OR1Idu8JN+UIdsWv9UGTchpw+f75ihkTVTN4OLdeUP5f4hv4L/Y 43EXIdMB84lFipOiZ4hctfcrC6KuhPZA9uIzbmhxF9ldah++VI8xMkf2WM5NryX0Um63 ZjXo6Lp5e30e0U4N0g0Q7TgivZUSw9VGCPedfXciI4G1moSOmjci/1Md3ZWEkbBMmqWh 3vwGo3ttCNC2MP8kj5Ba+dz3/+fM5y9JGca9P/L0gsbmonBhChMzV1upWjY4oHZmT4i7 8IIyMJ3Pn944ULZPgdo+lts6e/RLfUIedCsWxUmFBv70xioOoief2GYtP8WAQSayU0Ga 6DCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724407537; x=1725012337; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Yfjc6Gylvc1PhWnM9PVay5A/GfkR5Ub+Qyrfk3kk32M=; b=j6MAIPn/uTogaoTkUawJXW68VGWtR02Fysh4mkrHeNhtcgIe/ToshfPfacbOgejw1P 1c/hCgRwA0M/4KkRBAHIGmgAZ/Vz/nvdbBu9LF1PN6g63wjEiTKv56ghQ97ErGFHxakf 2I1R1s7BCISnarZ6SJHqMDB+HkkuOQNRh0uHZT3zcHtjkRPf2pw+/r0c7LhKZjHenOm3 FkbjGmB5m50cj4MfSfjK0gbQXRE6AXhAnvAb0L42+uf33odUyCrv1XOvwXMXCaMcOyYW CCxjqj11w++WcqBPJ5ryVCGvP51ywL9xG0VyqI0tlAKcAw73qENFyt/oUvau/av8zh/j +VJw== X-Gm-Message-State: AOJu0YyWm5jNZ7Swn4oMd5HKQ0jxQProIRn0TfrGr9Om9eZrRDVC+jZZ VUZtKkDVxf4YYqkAQKPgU2EWXydLKEt7ztq+PaDqNCjp8waa5UwHDO2OWw== X-Google-Smtp-Source: AGHT+IEKeIrG19QswnTiX4JyTw8v/sBLqLR50ehMmguZfv7N1hW4tjnjI7VIGR8S9EG6DQiIISimlQ== X-Received: by 2002:a05:6870:b418:b0:250:7465:d221 with SMTP id 586e51a60fabf-273e6520022mr1612592fac.28.1724407537235; Fri, 23 Aug 2024 03:05:37 -0700 (PDT) Original-Received: from LAPTOP-ACR66VVN (139-218-25-158.sta.wbroadband.net.au. [139.218.25.158]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-714342e442fsm2693647b3a.115.2024.08.23.03.05.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 03:05:36 -0700 (PDT) In-Reply-To: <-filg9QhoC3CircwDLuohUP6UvZ1KWTo7eUWUvUyQyLB9vi-ZpPKCdQS540lVRBny0N_OAkYOJeBYaOIa6sssmDBib5qdQmc_Ofs-GZR1yc=@protonmail.com> (Heime's message of "Tue, 20 Aug 2024 21:49:14 +0000") Received-SPF: pass client-ip=2001:4860:4864:20::2d; envelope-from=joel.reicher@gmail.com; helo=mail-oa1-x2d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147776 Archived-At: Heime writes: > My confusion is whether after making the minor-mode hooked to > emacs-lisp-mode, should I also make a hook to the function as > well ? In case it needs to be said, the purpose of a minor mode (and any mode, in fact) is to be able to change it while remaining in the same buffer, without modifying the buffer. In other words, you might switch a minor mode on or off while staying in the buffer. Or you might change major modes while staying in the buffer. But if what you want is for some code to always execute when you enter a particular major mode, that code is not a minor mode at all. It's just code that goes in the major mode's hook. Conversely, if you want the user to be able to activate and deactivate your minor mode at will, then you can't tie it to a major mode at all. By definition of what you're offering, that connection is up to the user. Cheers, - Joel