title: Switch auto-fill-mode in Emacs Lisp
body: <p>I am trying to make keyboard shortcut for toggling <code>auto-fill-mode</code> on or off.
  In my <code>~/.emacs</code> I have</p>
  
  <pre><code>(setq-default auto-fill-function 'do-auto-fill)
  </code></pre>
  
  <p>Now I tried to solve my problem using this function:</p>
  
  <pre><code>(defun my-switch-auto-fill-mode ()
    (interactive)
    (if (auto-fill-function)
        (auto-fill-mode 0)
      (auto-fill-mode 1)))
  </code></pre>
  
  <p>But it does not work..</p>