From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Rodrigo Morales Newsgroups: gmane.emacs.help Subject: How to disable abbrev-mode in all major modes? Date: Fri, 18 Oct 2024 18:34:38 -0500 Message-ID: <87ed4ddlyp.fsf@morales.pe> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9776"; mail-complaints-to="usenet@ciao.gmane.io" To: Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 19 01:35:41 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 1t1wVQ-0002R6-AF for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 19 Oct 2024 01:35:40 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1wUw-00070y-7t; Fri, 18 Oct 2024 19:35:12 -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 1t1wUp-0006wD-9K for help-gnu-emacs@gnu.org; Fri, 18 Oct 2024 19:35:04 -0400 Original-Received: from smtpout1.mo11.mail-out.ovh.ca ([51.161.45.253]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1wUi-0003Ci-Gx for help-gnu-emacs@gnu.org; Fri, 18 Oct 2024 19:35:00 -0400 Original-Received: from mxplan1.mail.ovh.ca (unknown [10.111.58.210]) by mo11.mail-out.ovh.ca (Postfix) with ESMTPS id 4XVgz92BVKzHpyL for ; Fri, 18 Oct 2024 20:34:45 -0300 (ADT) Original-Received: from morales.pe (54.39.251.56) by DAG2EX2.mxpca1.local (172.16.2.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 18 Oct 2024 19:34:44 -0400 Authentication-Results: garm.ovh; auth=pass (GARM-94B00119dd8e36-29d4-4a16-8768-7ee0d8dfcef1, 05DFB55D969307C52F5ED8FB9617293CD72C487D) smtp.auth=rodrigo-mailing-lists@morales.pe X-OVh-ClientIp: 190.233.209.18 X-Originating-IP: [54.39.251.56] X-ClientProxiedBy: DAG2EX1.mxpca1.local (172.16.2.11) To DAG2EX2.mxpca1.local (172.16.2.12) X-Ovh-Tracer-GUID: 1bcd4ae9-3bde-479d-8761-33da12640c24 X-Ovh-Tracer-Id: 17335480868272444951 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehgedgvdefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvffufffkgggtihesthdtredttddttdenucfhrhhomheptfhoughrihhgohcuofhorhgrlhgvshcuoehrohgurhhighhoqdhmrghilhhinhhgqdhlihhsthhssehmohhrrghlvghsrdhpvgeqnecuggftrfgrthhtvghrnhepvdffhfduleeihfeviedvieffuefgtdduledtvdfgkeefieetvefhfeduuddtkeejnecukfhppeduvdejrddtrddtrddupdehgedrfeelrddvhedurdehiedpudeltddrvdeffedrvddtledrudeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehrohgurhhighhoqdhmrghilhhinhhgqdhlihhsthhssehmohhrrghlvghsrdhpvgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehhvghlphdqghhnuhdqvghmrggtshesghhnuhdrohhrghdpoffvtefjohhsthepmhhouddupdhmohguvgepshhmthhpohhuth Received-SPF: pass client-ip=51.161.45.253; envelope-from=rodrigo-mailing-lists@morales.pe; helo=smtpout1.mo11.mail-out.ovh.ca X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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.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:148177 Archived-At: Let me explain my use case: I want abbrev-mode to be disabled in all buffers because I want to expand abbreviations by explicitly calling the function =expand-abbrev=, but the default behavior is that abbreviations are expanded when pressing SPC, punctuations (e.g. PERIOD and COMMA) or C-i. After some investigation, I found out that abbrev-mode is enabled in message-mode (see next section for details on how I found that out). I know that I can define a function that disables abbrev-mode and add it as a hook of those major modes where abbrev-mode is enabled by default, but I wonder if there is a cleaner way than doing this, because I don't want to be editing my configuration whenever I found out another major mode enables abbrev-mode by default. #+BEGIN_SRC elisp (defun my-abbrev-mode-disable () (abbrev-mode -1)) (add-hook 'message-mode-hook 'my-abbrev-mode-disable) #+END_SRC *** Finding out abbrev-mode is enabled in message-mode I started Emacs by using the command shown below: #+BEGIN_SRC sh emacs -Q #+END_SRC In the buffer =*scratch*=, the value of the variable =abbrev-mode= was nil, so I conclude that =abbrev-mode= was not enabled. The major mode of the buffer =*scratch*= was =lisp-interaction-mode=. I called compose-mail (by default bound to =C-x m= in GNU Emacs 29.4). In the buffer =*unsent mail*=, the value of the variable =abbrev-mode= was t, so I conclude that =abbrev-mode= was enabled. The major mode of the buffer =*unsent mail*= was =message-mode=.