* flyspell-prog-mode, flyspell-mode and different dictionary
@ 2024-07-23 10:45 Sébastien Gendre
2024-07-23 11:41 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Sébastien Gendre @ 2024-07-23 10:45 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 843 bytes --]
Hello,
I use a lot flyspell-mode when I write E-mails and Org-mode documents.
And by default, its language is set to french on my system. Which is my
main language.
Recently, I discovered flyspell-prog-mode and wanted to use it in all
programming language editing. But this time, set to english.
In the manual, I didn't found a way to set the spell check language
based on the mode. And there is no flyspell-prog-mode-hook.
Did I miss something ?
Or is the only solution is to attach a lambda function, to prog-mode-hook,
that will call flyspell-prog-mode and ispell-change-dictionary like
this:
(add-hook 'prog-mode-hook
'(lambda ()
(flyspell-prog-mode t)
(ispell-change-dictionary "english")))
Best regards
-------
Gendre Sébastien
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: flyspell-prog-mode, flyspell-mode and different dictionary
2024-07-23 10:45 flyspell-prog-mode, flyspell-mode and different dictionary Sébastien Gendre
@ 2024-07-23 11:41 ` Eli Zaretskii
2024-07-23 12:29 ` Joel Reicher
2024-07-23 14:56 ` Stefan Monnier via Users list for the GNU Emacs text editor
2 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2024-07-23 11:41 UTC (permalink / raw)
To: help-gnu-emacs
> From: Sébastien Gendre <seb@k-7.ch>
> Date: Tue, 23 Jul 2024 12:45:25 +0200
>
> Or is the only solution is to attach a lambda function, to prog-mode-hook,
> that will call flyspell-prog-mode and ispell-change-dictionary like
> this:
>
> (add-hook 'prog-mode-hook
> '(lambda ()
> (flyspell-prog-mode t)
> (ispell-change-dictionary "english")))
I don't know if this is the _only_ solution, but it is certainly a
valid solution. (Of course, the hook doesn't have to be a
lambda-function, it could be a named function.)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: flyspell-prog-mode, flyspell-mode and different dictionary
2024-07-23 10:45 flyspell-prog-mode, flyspell-mode and different dictionary Sébastien Gendre
2024-07-23 11:41 ` Eli Zaretskii
@ 2024-07-23 12:29 ` Joel Reicher
2024-07-23 12:49 ` Sébastien Gendre
2024-07-23 14:56 ` Stefan Monnier via Users list for the GNU Emacs text editor
2 siblings, 1 reply; 8+ messages in thread
From: Joel Reicher @ 2024-07-23 12:29 UTC (permalink / raw)
To: Sébastien Gendre; +Cc: help-gnu-emacs@gnu.org
Sébastien Gendre <seb@k-7.ch> writes:
> Recently, I discovered flyspell-prog-mode and wanted to use it
> in all programming language editing. But this time, set to
> english.
>
> In the manual, I didn't found a way to set the spell check
> language based on the mode. And there is no
> flyspell-prog-mode-hook.
Have you checked the definition of flyspell-prog-mode?
In my installation (29.4) it calls flyspell-prog-mode-hook.
Possibly you are being misled by this hook being undefined by
default?
Regards,
- Joel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: flyspell-prog-mode, flyspell-mode and different dictionary
2024-07-23 12:29 ` Joel Reicher
@ 2024-07-23 12:49 ` Sébastien Gendre
2024-07-24 0:39 ` Joel Reicher
0 siblings, 1 reply; 8+ messages in thread
From: Sébastien Gendre @ 2024-07-23 12:49 UTC (permalink / raw)
To: Joel Reicher; +Cc: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 710 bytes --]
I checked for variable `flyspell-prog-mode-hook` with
`describe-variable`, with no success.
Joel Reicher <joel.reicher@gmail.com> writes:
> Sébastien Gendre <seb@k-7.ch> writes:
>
>> Recently, I discovered flyspell-prog-mode and wanted to use it in
>> all programming language editing. But this time, set to english.
>>
>> In the manual, I didn't found a way to set the spell check language
>> based on the mode. And there is no flyspell-prog-mode-hook.
>
> Have you checked the definition of flyspell-prog-mode?
>
> In my installation (29.4) it calls flyspell-prog-mode-hook.
>
> Possibly you are being misled by this hook being undefined by default?
>
> Regards,
>
> - Joel
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: flyspell-prog-mode, flyspell-mode and different dictionary
2024-07-23 10:45 flyspell-prog-mode, flyspell-mode and different dictionary Sébastien Gendre
2024-07-23 11:41 ` Eli Zaretskii
2024-07-23 12:29 ` Joel Reicher
@ 2024-07-23 14:56 ` Stefan Monnier via Users list for the GNU Emacs text editor
2 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-07-23 14:56 UTC (permalink / raw)
To: help-gnu-emacs
> (add-hook 'prog-mode-hook
> '(lambda ()
Please don't quote lambdas.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: flyspell-prog-mode, flyspell-mode and different dictionary
2024-07-23 12:49 ` Sébastien Gendre
@ 2024-07-24 0:39 ` Joel Reicher
2024-07-24 12:56 ` Michael Heerdegen via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 8+ messages in thread
From: Joel Reicher @ 2024-07-24 0:39 UTC (permalink / raw)
To: Sébastien Gendre; +Cc: help-gnu-emacs@gnu.org
Sébastien Gendre <seb@k-7.ch> writes:
> I checked for variable `flyspell-prog-mode-hook` with
> `describe-variable`, with no success.
Undefined variables won't show up there, which is why I asked if
you checked the definition of the flyspell-prog-mode *function*.
If you setq an undefined variable, it will define it, and if your
version of the mode references this (previously undefined)
variable, it will work as you expect.
Regards,
- Joel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: flyspell-prog-mode, flyspell-mode and different dictionary
2024-07-24 0:39 ` Joel Reicher
@ 2024-07-24 12:56 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-24 13:42 ` Sébastien Gendre
0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-07-24 12:56 UTC (permalink / raw)
To: help-gnu-emacs
Joel Reicher <joel.reicher@gmail.com> writes:
> Sébastien Gendre <seb@k-7.ch> writes:
>
> > I checked for variable `flyspell-prog-mode-hook` with
> > `describe-variable`, with no success.
>
> Undefined variables won't show up there, which is why I asked if you
> checked the definition of the flyspell-prog-mode *function*.
>
> If you setq an undefined variable, it will define it, and if your
> version of the mode references this (previously undefined) variable,
> it will work as you expect.
With other words: You can (add-hook 'flyspell-prog-mode-hook ...) even
when flyspell-prog-mode-hook is void, without error. And enabling
`flyspell-prog-mode' _will_ look at and use the binding.
Michael.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: flyspell-prog-mode, flyspell-mode and different dictionary
2024-07-24 12:56 ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-07-24 13:42 ` Sébastien Gendre
0 siblings, 0 replies; 8+ messages in thread
From: Sébastien Gendre @ 2024-07-24 13:42 UTC (permalink / raw)
To: Michael Heerdegen via Users list for the GNU Emacs text editor
Cc: Michael Heerdegen
[-- Attachment #1: Type: text/plain, Size: 883 bytes --]
Ok. Thank you very much. :)
Michael Heerdegen via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> writes:
> Joel Reicher <joel.reicher@gmail.com> writes:
>
>> Sébastien Gendre <seb@k-7.ch> writes:
>>
>> > I checked for variable `flyspell-prog-mode-hook` with
>> > `describe-variable`, with no success.
>>
>> Undefined variables won't show up there, which is why I asked if you
>> checked the definition of the flyspell-prog-mode *function*.
>>
>> If you setq an undefined variable, it will define it, and if your
>> version of the mode references this (previously undefined) variable,
>> it will work as you expect.
>
> With other words: You can (add-hook 'flyspell-prog-mode-hook ...) even
> when flyspell-prog-mode-hook is void, without error. And enabling
> `flyspell-prog-mode' _will_ look at and use the binding.
>
>
> Michael.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-07-24 13:42 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-23 10:45 flyspell-prog-mode, flyspell-mode and different dictionary Sébastien Gendre
2024-07-23 11:41 ` Eli Zaretskii
2024-07-23 12:29 ` Joel Reicher
2024-07-23 12:49 ` Sébastien Gendre
2024-07-24 0:39 ` Joel Reicher
2024-07-24 12:56 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-24 13:42 ` Sébastien Gendre
2024-07-23 14:56 ` Stefan Monnier via Users list for the GNU Emacs text editor
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.