all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kristoffer Balintona <krisbalintona@gmail.com>
To: Rodrigo Morales <rodrigo-mailing-lists@morales.pe>,
	help-gnu-emacs@gnu.org
Subject: Re: How to disable abbrev-mode in all major modes?
Date: Fri, 18 Oct 2024 17:28:04 -0700	[thread overview]
Message-ID: <CANVbq5n9rqQx=1qUkP3SE3tTriyHTydbELYhcrn7-Nm_-=vC5g@mail.gmail.com> (raw)
In-Reply-To: <87ed4ddlyp.fsf@morales.pe>

On Fri, Oct 18 2024, Rodrigo Morales wrote:

> 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=.
>

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.

-- 
Best,
Kristoffer



  reply	other threads:[~2024-10-19  0:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18 23:34 How to disable abbrev-mode in all major modes? Rodrigo Morales
2024-10-19  0:28 ` Kristoffer Balintona [this message]
2024-10-19  5:52 ` Michael Heerdegen via Users list for the GNU Emacs text editor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANVbq5n9rqQx=1qUkP3SE3tTriyHTydbELYhcrn7-Nm_-=vC5g@mail.gmail.com' \
    --to=krisbalintona@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=rodrigo-mailing-lists@morales.pe \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.