I've got an emacs configuration file whatever.el
:
(abbrev-mode +1)
(provide 'whatever)
and in my init.el
:
(require 'whatever)
but when i start emacs, abbrev-mode
isn't enabled. why ?
thank you
Abbrev-mode is enabled per-buffer.
One way is to create a hook function that you could add to the major mode hooks you will want to use it in.
For example:
(defun my-enable-abbrev-mode ()
(abbrev-mode 1))
(add-hook 'c-mode-hook 'my-enable-abbrev-hook)
(add-hook 'java-mode-hook 'my-enable-abbrev-hook)
Another approach is to use change-major-mode-hook
.
While others explained how to get what you presumably want, I'll just point out that w.r.t to your actual question ("Why?"), the reason is simple: abbrev-mode is a buffer-local minor-mode, so when you run (abbrev-mode +1) at startup it will just enable abbrev-mode in the buffer that happens to be current during evaluation of the ~/.emacs
(typically scratch) but not in subsequent buffers.
Quoting from http://emacswiki.org/emacs/AbbrevMode: