unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to disable abbrev-mode in all major modes?
@ 2024-10-18 23:34 Rodrigo Morales
  2024-10-19  0:28 ` Kristoffer Balintona
  2024-10-19  5:52 ` Michael Heerdegen via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 3+ messages in thread
From: Rodrigo Morales @ 2024-10-18 23:34 UTC (permalink / raw)
  To: help-gnu-emacs


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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-19  5:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-18 23:34 How to disable abbrev-mode in all major modes? Rodrigo Morales
2024-10-19  0:28 ` Kristoffer Balintona
2024-10-19  5:52 ` Michael Heerdegen via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).