Next: , Previous: Displaying the current file name in the titlebar, Up: Common requests

5.7 How do I turn on abbrevs by default just in mode mymode?

Abbrev mode expands abbreviations as you type them. To turn it on in a specific buffer, use M-x abbrev-mode. To turn it on in every buffer by default, put this in your .emacs file:

     (setq-default abbrev-mode t)

To turn it on in a specific mode, use:

     (add-hook 'mymode-mode-hook
               (lambda ()
                (setq abbrev-mode t)))

If your Emacs version is older then 22.1, you will also need to use:

     (condition-case ()
       (file-error nil))