From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kristoffer Balintona Newsgroups: gmane.emacs.help Subject: Re: How to disable abbrev-mode in all major modes? Date: Fri, 18 Oct 2024 17:28:04 -0700 Message-ID: References: <87ed4ddlyp.fsf@morales.pe> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31647"; mail-complaints-to="usenet@ciao.gmane.io" To: Rodrigo Morales , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 19 02:28:53 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 1t1xKu-00088I-0x for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 19 Oct 2024 02:28:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1xKF-0003wr-DG; Fri, 18 Oct 2024 20:28:11 -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 1t1xKD-0003wH-NS for help-gnu-emacs@gnu.org; Fri, 18 Oct 2024 20:28:09 -0400 Original-Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t1xKB-0008IO-QD for help-gnu-emacs@gnu.org; Fri, 18 Oct 2024 20:28:09 -0400 Original-Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-539e8607c2aso3028532e87.3 for ; Fri, 18 Oct 2024 17:28:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729297685; x=1729902485; darn=gnu.org; h=content-transfer-encoding:to:subject:message-id:date:mime-version :references:in-reply-to:from:from:to:cc:subject:date:message-id :reply-to; bh=stp0ooi8MUx9i5K+Rp7RYemUrBnIohyNN4xLKqPw2Bk=; b=ZR5sDbnhSSfqiSi2tF3gRVlXTVk1w2WscyJaW79pQlxB7zKeXpgPn1WR7EUnpCN0N4 oBD5LMkcBvaGsd91/uNKA78J4GroN1pnu5cI2wfyS6KfaRjou4emBg8nCSfekv6lZWmV p55TJ8jv7zh+MBQy+YeQ66dO3BfM5BN4n/YjoelP6xBymojJJxIazprIf5oZF4dime8T CYPUr3t5nUDCEhoGl/w3Nxhkil2MMVfu2Gty7VcOTMMWaxtqGW5sk+inYDlaGb6FziU8 WodY5y9UJy+cJnamMk0VyWPAGGce4a9BsEbEDOUvz/31koYhtpfRQ19+15JU8lILi8ds pApw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729297685; x=1729902485; h=content-transfer-encoding:to:subject:message-id:date:mime-version :references:in-reply-to:from:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=stp0ooi8MUx9i5K+Rp7RYemUrBnIohyNN4xLKqPw2Bk=; b=JSqXSaQr+bIVM8UTpcaMRaxcxebLKr4qp6MuC2BTtDao8VNK6S8T1Y2c8ooc88Yibd UdckzuPrUj7+5ZRBK5uG1nYrbkv4/F1I4zc+Cwub6oq/NQfaBE7Slg8R/O1qfkY4fvHI RfuLElU4q1YYn2Tqw7Ls+Y0QrS/uIjx8KMbMz3GX1XObN1uoqv5SCUtVt4zbPDnxWXG9 WahQNe2EdJe94k1HzpXP3zcMN517rcsCs/UNsyek/bymfN/WC8UUfPXMseLYjjyowfOc PyEBCy4iML+8CENRZVhEjFmzyPAPAVKEVuW1L9zodM3stW/Hl9v75/3L21OQB55d7650 vmKQ== X-Forwarded-Encrypted: i=1; AJvYcCWHnBB0SZFS+Zn1o1vQU9ojzjJ29eYezHQVRkGokQLlN2howjrMWlQ3sSk5DvwL04K0saxzMQ/KoKvYwOn0Ng==@gnu.org X-Gm-Message-State: AOJu0Yx1pip9mza53gKYBHmb1uyd3IwvlEfY16cgJhBk11lep2tu01S6 o2fmr+kaTtxFw8Zu+TSjqiL+lRpcqdjJNfIDb5yxkcQDSFyHlIJTIqTjEk968DV3hI+phGtAgid zB7OpQwHFicY1M+R3ClavokyDMMOcnrIl X-Google-Smtp-Source: AGHT+IE0vyF34PxZ+K6oX4sCOBMJdgP9aoZzSJ5i9AZ9m0grtEBlAAFEvTwKuTYM1MJ4ZE45OCufePOmbVOQZWSJBe4= X-Received: by 2002:a05:6512:3f13:b0:539:e14b:309c with SMTP id 2adb3069b0e04-53a1544497bmr2545642e87.19.1729297685012; Fri, 18 Oct 2024 17:28:05 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 18 Oct 2024 17:28:04 -0700 In-Reply-To: <87ed4ddlyp.fsf@morales.pe> Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=krisbalintona@gmail.com; helo=mail-lf1-x135.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 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:148178 Archived-At: On Fri, Oct 18 2024, Rodrigo Morales wrote: > Let me explain my use case: I want abbrev-mode to be disabled in all buff= ers because I want to expand abbreviations by explicitly calling the functi= on =3Dexpand-abbrev=3D, but the default behavior is that abbreviations are = expanded when pressing SPC, punctuations (e.g. PERIOD and COMMA) or C-i. Af= ter 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 t= o be editing my configuration whenever I found out another major mode enabl= es 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 =3D*scratch*=3D, the value of the variable =3Dabbrev-mode= =3D was nil, so I conclude that =3Dabbrev-mode=3D was not enabled. The majo= r mode of the buffer =3D*scratch*=3D was =3Dlisp-interaction-mode=3D. > > I called compose-mail (by default bound to =3DC-x m=3D in GNU Emacs 29.4)= . In the buffer =3D*unsent mail*=3D, the value of the variable =3Dabbrev-mo= de=3D was t, so I conclude that =3Dabbrev-mode=3D was enabled. The major mo= de of the buffer =3D*unsent mail*=3D was =3Dmessage-mode=3D. > I use (setq-default abbrev-mode t) to enable abbrev-mode globally, so I think (setq-default abbrev-mode nil) would disable it globally. Though I haven't tested this. --=20 Best, Kristoffer