unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* About multiple spelling in Emacs
@ 2020-05-10 15:51 Angelo Graziosi
  2020-05-10 16:08 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Angelo Graziosi @ 2020-05-10 15:51 UTC (permalink / raw)
  To: emacs-devel

I see that some browser allow for spelling in two languages (say italian and english). Can we do the same in Emacs? How?

Thanks,
  Angelo.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: About multiple spelling in Emacs
  2020-05-10 15:51 About multiple spelling in Emacs Angelo Graziosi
@ 2020-05-10 16:08 ` Eli Zaretskii
  2020-05-11 10:10   ` Angelo Graziosi
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2020-05-10 16:08 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: emacs-devel

> Date: Sun, 10 May 2020 17:51:50 +0200 (CEST)
> From: Angelo Graziosi <angelo.g0@libero.it>
> 
> I see that some browser allow for spelling in two languages (say italian and english). Can we do the same in Emacs? How?

You mean, spell-checking text that mixes 2 languages?  That's possible
with Hunspell, yes.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: About multiple spelling in Emacs
  2020-05-10 16:08 ` Eli Zaretskii
@ 2020-05-11 10:10   ` Angelo Graziosi
  2020-05-11 10:18     ` Manuel Uberti
                       ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Angelo Graziosi @ 2020-05-11 10:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel


> Il 10 maggio 2020 alle 18.08 Eli Zaretskii ha scritto:
> 
> 
> > Date: Sun, 10 May 2020 17:51:50 +0200 (CEST)
> > From: Angelo Graziosi
> > 
> > I see that some browser allow for spelling in two languages (say italian and english). Can we do the same in Emacs? How?
> 
> You mean, spell-checking text that mixes 2 languages?  That's possible
> with Hunspell, yes.

But, how? How can I instruct Emacs to use two dictionaries, say Italian and English?

TIA



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: About multiple spelling in Emacs
  2020-05-11 10:10   ` Angelo Graziosi
@ 2020-05-11 10:18     ` Manuel Uberti
  2020-05-11 11:00     ` Colin Baxter
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Manuel Uberti @ 2020-05-11 10:18 UTC (permalink / raw)
  To: emacs-devel

On 11/05/20 12:10, Angelo Graziosi wrote:
> 
> But, how? How can I instruct Emacs to use two dictionaries, say Italian and English?
> 
> TIA
> 

Hi Angelo,

I don't know if this could be of any help but there is already a package by
Titus von der Malsburg who I think does what you are asking for: guess-language[1].

Note: I am not using the package.

[1] https://github.com/tmalsburg/guess-language.el

-- 
Manuel Uberti
www.manueluberti.eu



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: About multiple spelling in Emacs
  2020-05-11 10:10   ` Angelo Graziosi
  2020-05-11 10:18     ` Manuel Uberti
@ 2020-05-11 11:00     ` Colin Baxter
  2020-05-11 11:28       ` H. Dieter Wilhelm
  2020-05-11 11:41     ` Gustavo Barros
  2020-05-11 15:16     ` Eli Zaretskii
  3 siblings, 1 reply; 10+ messages in thread
From: Colin Baxter @ 2020-05-11 11:00 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: emacs-devel

Hello Angelo,
>>>>> Angelo Graziosi <angelo.g0@libero.it> writes:

    >> Il 10 maggio 2020 alle 18.08 Eli Zaretskii ha scritto:
    >> 
    >> 
    >> > Date: Sun, 10 May 2020 17:51:50 +0200 (CEST) > From: Angelo
    >> Graziosi
    >> > 
    >> > I see that some browser allow for spelling in two languages
    >> (say > italian and english). Can we do the same in Emacs? How?
    >> 
    >> You mean, spell-checking text that mixes 2 languages?  That's
    >> possible with Hunspell, yes.

    > But, how? How can I instruct Emacs to use two dictionaries, say
    > Italian and English?

I use ispell and switch from English to Latin setting a local variable
ispell-local-dictionary: "latin". If the file, however, has a mixture of
English and Latin then I use a defun:

#+begin_src elisp
(defun my-ispell-latin ()
      "Switch to the Latin dictionary."
      (interactive)
;; Change personal dict - 1st line personal dict must match language (latin)
      (setq ispell-personal-dictionary "~/.emacs-files/dicts/latin.pws")
      (ispell-change-dictionary "latin"))
#+end_src

To change back I use another defun for the next language, written in
exactly the same way. Ok, I know, my method is crude, sort of cargo cult
programming, but it works for me. 

Best wishes,

Colin.


Colin Baxter
URL: http://www.Colin-Baxter.com



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: About multiple spelling in Emacs
  2020-05-11 11:00     ` Colin Baxter
@ 2020-05-11 11:28       ` H. Dieter Wilhelm
  2020-05-11 12:24         ` Colin Baxter
  0 siblings, 1 reply; 10+ messages in thread
From: H. Dieter Wilhelm @ 2020-05-11 11:28 UTC (permalink / raw)
  To: Colin Baxter; +Cc: Angelo Graziosi, emacs-devel

Hello Colin

Colin Baxter <m43cap@yandex.com> writes:

>     > But, how? How can I instruct Emacs to use two dictionaries, say
>     > Italian and English?
>
> I use ispell and switch from English to Latin setting a local variable
> ispell-local-dictionary: "latin". If the file, however, has a mixture of
> English and Latin then I use a defun:
>
> #+begin_src elisp
> (defun my-ispell-latin ()
>       "Switch to the Latin dictionary."
>       (interactive)
> ;; Change personal dict - 1st line personal dict must match language (latin)
>       (setq ispell-personal-dictionary "~/.emacs-files/dicts/latin.pws")
>       (ispell-change-dictionary "latin"))
> #+end_src

FYI: I'm using the very same Ispell commands but I've installed Aspell
and have the impression, that Emacs or Aspell - don't know - is changing
automatically the personal dictionary when using ispell-change
dictionary...

> To change back I use another defun for the next language, written in
> exactly the same way. Ok, I know, my method is crude, sort of cargo cult
> programming, but it works for me. 

I think the above is working for larger language blocks but is not so
good for interspersed texts in another language.

As Eli mentioned already multiple language checking should work with
Hunspell under Emacs.  I didn't yet convert to Hunspell but maybe the
following link will help you to set it up:

https://emacs.stackexchange.com/questions/21378/spell-check-with-multiple-dictionaries

        Dieter

-- 
Best wishes
H. Dieter Wilhelm
Zwingenberg, Germany



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: About multiple spelling in Emacs
  2020-05-11 10:10   ` Angelo Graziosi
  2020-05-11 10:18     ` Manuel Uberti
  2020-05-11 11:00     ` Colin Baxter
@ 2020-05-11 11:41     ` Gustavo Barros
  2020-05-11 15:16     ` Eli Zaretskii
  3 siblings, 0 replies; 10+ messages in thread
From: Gustavo Barros @ 2020-05-11 11:41 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: emacs-devel


Hi Angelo,

On Mon, May 11 2020, Angelo Graziosi wrote:

>> Il 10 maggio 2020 alle 18.08 Eli Zaretskii ha scritto:
>> 
>> > Date: Sun, 10 May 2020 17:51:50 +0200 (CEST)
>> > From: Angelo Graziosi
>> > 
>> > I see that some browser allow for spelling in two languages (say italian
>> > and english). Can we do the same in Emacs? How?
>> 
>> You mean, spell-checking text that mixes 2 languages?  That's possible
>> with Hunspell, yes.
>
> But, how? How can I instruct Emacs to use two dictionaries, say Italian and English?
>
> TIA

It is indeed possible with hunspell, as Eli mentioned. I use the
following settings for this:

#+begin_src emacs-lisp
(use-package ispell
  :custom
  (ispell-program-name "hunspell")
  (ispell-dictionary "en_US,pt_BR")

  :config
  ;; from https://emacs.stackexchange.com/a/21379/18951
  (ispell-set-spellchecker-params)
  (ispell-hunspell-add-multi-dic "en_US,pt_BR"))
#+end_src

It works very well for me.

You might interested in a recent thread about spell-checking at Reddit:
https://www.reddit.com/r/emacs/comments/fxs92h/spell_checkers_in_emacs_in_2020/

Using multiple dictionaries was also discussed there.  In particular, I
received nice tips from Alan Third on how to fine tune hunspell for the
case quote contractions (common in English) with curly quotes and
multiple dictionaries.

HTH,
Gustavo.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: About multiple spelling in Emacs
  2020-05-11 11:28       ` H. Dieter Wilhelm
@ 2020-05-11 12:24         ` Colin Baxter
  0 siblings, 0 replies; 10+ messages in thread
From: Colin Baxter @ 2020-05-11 12:24 UTC (permalink / raw)
  To: H. Dieter Wilhelm; +Cc: Angelo Graziosi, emacs-devel

Hello Dieter
>>>>> H Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:

    > Hello Colin Colin Baxter <m43cap@yandex.com> writes:

    >> > But, how? How can I instruct Emacs to use two dictionaries, say
    >> > Italian and English?
    >> 
    >> I use ispell and switch from English to Latin setting a local
    >> variable ispell-local-dictionary: "latin". If the file, however,
    >> has a mixture of English and Latin then I use a defun:
    >> 
    >> #+begin_src elisp (defun my-ispell-latin () "Switch to the Latin
    >> dictionary."  (interactive) ;; Change personal dict - 1st line
    >> personal dict must match language (latin) (setq
    >> ispell-personal-dictionary "~/.emacs-files/dicts/latin.pws")
    >> (ispell-change-dictionary "latin")) #+end_src

    > FYI: I'm using the very same Ispell commands but I've installed
    > Aspell and have the impression, that Emacs or Aspell - don't know
    > - is changing automatically the personal dictionary when using
    > ispell-change dictionary...

    >> To change back I use another defun for the next language, written
    >> in exactly the same way. Ok, I know, my method is crude, sort of
    >> cargo cult programming, but it works for me.

    > I think the above is working for larger language blocks but is not
    > so good for interspersed texts in another language.

    > As Eli mentioned already multiple language checking should work
    > with Hunspell under Emacs.  I didn't yet convert to Hunspell but
    > maybe the following link will help you to set it up:

    > https://emacs.stackexchange.com/questions/21378/spell-check-with-multiple-dictionaries

Thanks for your suggestion. There is another reason why I prefer ispell,
which I didn't mention. I'm using aspell, which, as you know, works
seamlessly with ispell, to compile a dictionary of specialist terms, and
I don't want to change software mid-project. But thanks again - I didn't
know of the link.

Best wishes,

Colin.


Colin Baxter
URL: http://www.Colin-Baxter.com



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: About multiple spelling in Emacs
  2020-05-11 10:10   ` Angelo Graziosi
                       ` (2 preceding siblings ...)
  2020-05-11 11:41     ` Gustavo Barros
@ 2020-05-11 15:16     ` Eli Zaretskii
  2020-05-11 20:20       ` Angelo Graziosi
  3 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2020-05-11 15:16 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: emacs-devel

> Date: Mon, 11 May 2020 12:10:49 +0200 (CEST)
> From: Angelo Graziosi <angelo.g0@libero.it>
> Cc: emacs-devel@gnu.org
> 
> > You mean, spell-checking text that mixes 2 languages?  That's possible
> > with Hunspell, yes.
> 
> But, how? How can I instruct Emacs to use two dictionaries, say Italian and English?

See the doc string of ispell-hunspell-add-multi-dic.  Also, someone
posted a stack-exchange URL where this question was answered in more
detail.

In a nutshell, you tell Emacs to invoke Hunspell with a list of two or
more dictionaries instead of just one.  There's a caveat: you may have
typos not flagged as such because a typo in one language might be a
valid word in another.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: About multiple spelling in Emacs
  2020-05-11 15:16     ` Eli Zaretskii
@ 2020-05-11 20:20       ` Angelo Graziosi
  0 siblings, 0 replies; 10+ messages in thread
From: Angelo Graziosi @ 2020-05-11 20:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel


> Il 11 maggio 2020 alle 17.16 Eli Zaretskii ha scritto:
> 
> 

> 
> See the doc string of ispell-hunspell-add-multi-dic.  Also, someone
> posted a stack-exchange URL where this question was answered in more
> detail.
> 
> In a nutshell, you tell Emacs to invoke Hunspell with a list of two or
> more dictionaries instead of just one.  There's a caveat: you may have
> typos not flagged as such because a typo in one language might be a
> valid word in another.

Thanks for all your suggestions and clarifications. I wil try to setup that!



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-05-11 20:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-10 15:51 About multiple spelling in Emacs Angelo Graziosi
2020-05-10 16:08 ` Eli Zaretskii
2020-05-11 10:10   ` Angelo Graziosi
2020-05-11 10:18     ` Manuel Uberti
2020-05-11 11:00     ` Colin Baxter
2020-05-11 11:28       ` H. Dieter Wilhelm
2020-05-11 12:24         ` Colin Baxter
2020-05-11 11:41     ` Gustavo Barros
2020-05-11 15:16     ` Eli Zaretskii
2020-05-11 20:20       ` Angelo Graziosi

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).