I would like to be able to toggle abbrev-mode on and off with ease. Of course I could use

M-x abbrev-mode

But I would like to set this to some keyboard shortcut. To this end I've added the following to my .emacs file

(global-set-key (kbd "<f7>") (lambda () (interactive) (abbrev-mode nil)))

But this doesn't have the desired effect. How do I enable this functionality?

  • possible duplicate of global-auto-revert-mode doesn't seem to work? May 8 '15 at 13:06
  • There is a difference between calling a function in a interactive command, and calling a function interactively. Like abo-abo specified, you just need to remove the wrapper lambda, but you could also use call-interactively in your lambda to solve the problem. May 8 '15 at 14:12

Remove the wrapper:

(global-set-key (kbd "<f7>") 'abbrev-mode)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.