0

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?

JeffDror
  • 53
  • 5
  • possible duplicate of [global-auto-revert-mode doesn't seem to work?](http://emacs.stackexchange.com/questions/10966/global-auto-revert-mode-doesnt-seem-to-work) – Kaushal Modi May 08 '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. – Jordon Biondo May 08 '15 at 14:12

1 Answers1

2

Remove the wrapper:

(global-set-key (kbd "<f7>") 'abbrev-mode)
abo-abo
  • 13,943
  • 1
  • 29
  • 43