5
votes

I'm trying to write a small lisp function to run flyspell in a single org-mode branch. I have added this to my .emacs file:

(defun flyspell-current-tree()
  (interactive)
  (org-mark-subtree)
  (flyspell-region))

(global-set-key (kbd "S-<f8>") 'flyspell-current-tree)

But when running it I get the following error:

flyspell-current-tree: Wrong number of arguments

Any ideas?

1

1 Answers

6
votes

You need to provide beg and end to flyspell-region for it to work properly. The error is coming from that and not actually from your function.

If you include (point) and (mark) as arguments to flyspell-region it will work properly.

(defun flyspell-current-tree()
  (interactive)
  (org-mark-subtree)
  (flyspell-region (point) (mark)))