Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using flyspell in the current org-mode tree

Tags:

emacs

org-mode

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?

like image 458
Julian Avatar asked Apr 23 '12 15:04

Julian


1 Answers

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)))
like image 106
Jonathan Leech-Pepin Avatar answered Oct 14 '22 01:10

Jonathan Leech-Pepin