Subject: Re: bug#8151: add flyspell-prog-mode initiation example to Info

From: Kevin Rodgers <[email-masked]>
Date: Thu, 03 Mar 2011 00:35:59 -0700

On 3/2/11 5:22 AM, [email-masked] wrote:
> In (info "(emacs) Spelling")
>
>     Type `M-x flyspell-mode' to enable or disable this mode in the
>     current buffer. To enable `flyspell-mode' in all text mode buffers,
>     add `turn-on-flyspell' to `text-mode-hook'. ...
>
>        Flyspell Prog mode works just like ordinary Flyspell mode, except
>     that it only checks words in comments and string constants.  This
>     feature is useful for editing programs.  Type `M-x flyspell-prog-mode'
>     to enable or disable this mode in the current buffer.
>
> OK, but the second paragraph doesn't say what hook to turn
> flyspell-prog-mode on for all programs!

In the absence of specific information, use the same method you would use to
turn any other minor mode on for all buffers in a particular major mode (or its
derivatives).

> Or mention how to turn it on one by one...

Do you mean buffer by buffer, or major mode by major mode?

Either way, that is not specific to flyspell-prog-mode.

> Well it turns out one needs to use a totally different method to turn on
> flyspell-prog-mode, e.g.,
> (add-hook 'perl-mode-hook
>    (function (lambda ()(flyspell-prog-mode))))
> And it turns out there is no way to turn off flyspell-prog-mode... OK,
> probably just turn off flyspell-mode.

(function (lambda () (foo-mode))) = (lambda () (foo-mode)) = (function foo-mode) 
= (quote foo) = 'foo

(funcall 'turn-on-foo-mode) = (foo-mode 1) = (foo-mode)

> Also in the mode line there is no distinction of the two types of
> flyspell-mode... probably because no big deal.

It might make sense to use Fly/Text and Fly/Prog in the mode line.

-- 
Kevin Rodgers
Denver, Colorado, USA