Make hunspell work with emacs and german language

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












7















I want to make hunspell work with emacs24 and a german dictionary on a ubuntu 13.04-box.



To do so I installed hunspell and hunspell-de and added the following to my .emacs file:



(setq ispell-program-name "hunspell")
(setq ispell-dictionary "deutsch8")


When I open a file in emacs and start flyspell-buffer I get Starting new Ispell process [[hunspell::deutsch8]] but it blocks the emacs buffer (mouse becomes a rotating disk indicating to wait) and works for endless without showing any results. So there must be something wrong with my config.



Without the second line it works, but only for english texts.



So what's the best way to setup hunspell for emacs24 with a german dictionary on ubuntu 13.04? Are there any possible pitfalls?










share|improve this question
























  • Note that the dictonary names are different for hunspell compared to ispell. Instead of (setq ispell-dictionary "deutsch8"), you should use (setq ispell-dictionary "de_DE"). Note, however, that this requires emacs 24.4 or greater. For earlier versions you need add the definitions to ispell-local-dictionary-alist as provided in the accepted answer.

    – Christian Herenz
    Nov 26 '18 at 19:38
















7















I want to make hunspell work with emacs24 and a german dictionary on a ubuntu 13.04-box.



To do so I installed hunspell and hunspell-de and added the following to my .emacs file:



(setq ispell-program-name "hunspell")
(setq ispell-dictionary "deutsch8")


When I open a file in emacs and start flyspell-buffer I get Starting new Ispell process [[hunspell::deutsch8]] but it blocks the emacs buffer (mouse becomes a rotating disk indicating to wait) and works for endless without showing any results. So there must be something wrong with my config.



Without the second line it works, but only for english texts.



So what's the best way to setup hunspell for emacs24 with a german dictionary on ubuntu 13.04? Are there any possible pitfalls?










share|improve this question
























  • Note that the dictonary names are different for hunspell compared to ispell. Instead of (setq ispell-dictionary "deutsch8"), you should use (setq ispell-dictionary "de_DE"). Note, however, that this requires emacs 24.4 or greater. For earlier versions you need add the definitions to ispell-local-dictionary-alist as provided in the accepted answer.

    – Christian Herenz
    Nov 26 '18 at 19:38














7












7








7


4






I want to make hunspell work with emacs24 and a german dictionary on a ubuntu 13.04-box.



To do so I installed hunspell and hunspell-de and added the following to my .emacs file:



(setq ispell-program-name "hunspell")
(setq ispell-dictionary "deutsch8")


When I open a file in emacs and start flyspell-buffer I get Starting new Ispell process [[hunspell::deutsch8]] but it blocks the emacs buffer (mouse becomes a rotating disk indicating to wait) and works for endless without showing any results. So there must be something wrong with my config.



Without the second line it works, but only for english texts.



So what's the best way to setup hunspell for emacs24 with a german dictionary on ubuntu 13.04? Are there any possible pitfalls?










share|improve this question
















I want to make hunspell work with emacs24 and a german dictionary on a ubuntu 13.04-box.



To do so I installed hunspell and hunspell-de and added the following to my .emacs file:



(setq ispell-program-name "hunspell")
(setq ispell-dictionary "deutsch8")


When I open a file in emacs and start flyspell-buffer I get Starting new Ispell process [[hunspell::deutsch8]] but it blocks the emacs buffer (mouse becomes a rotating disk indicating to wait) and works for endless without showing any results. So there must be something wrong with my config.



Without the second line it works, but only for english texts.



So what's the best way to setup hunspell for emacs24 with a german dictionary on ubuntu 13.04? Are there any possible pitfalls?







emacs spell-checking hunspell






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 12 at 0:15









Jonas Stein

1,17121136




1,17121136










asked Aug 13 '13 at 10:06









studentstudent

7,0351763122




7,0351763122












  • Note that the dictonary names are different for hunspell compared to ispell. Instead of (setq ispell-dictionary "deutsch8"), you should use (setq ispell-dictionary "de_DE"). Note, however, that this requires emacs 24.4 or greater. For earlier versions you need add the definitions to ispell-local-dictionary-alist as provided in the accepted answer.

    – Christian Herenz
    Nov 26 '18 at 19:38


















  • Note that the dictonary names are different for hunspell compared to ispell. Instead of (setq ispell-dictionary "deutsch8"), you should use (setq ispell-dictionary "de_DE"). Note, however, that this requires emacs 24.4 or greater. For earlier versions you need add the definitions to ispell-local-dictionary-alist as provided in the accepted answer.

    – Christian Herenz
    Nov 26 '18 at 19:38

















Note that the dictonary names are different for hunspell compared to ispell. Instead of (setq ispell-dictionary "deutsch8"), you should use (setq ispell-dictionary "de_DE"). Note, however, that this requires emacs 24.4 or greater. For earlier versions you need add the definitions to ispell-local-dictionary-alist as provided in the accepted answer.

– Christian Herenz
Nov 26 '18 at 19:38






Note that the dictonary names are different for hunspell compared to ispell. Instead of (setq ispell-dictionary "deutsch8"), you should use (setq ispell-dictionary "de_DE"). Note, however, that this requires emacs 24.4 or greater. For earlier versions you need add the definitions to ispell-local-dictionary-alist as provided in the accepted answer.

– Christian Herenz
Nov 26 '18 at 19:38











2 Answers
2






active

oldest

votes


















4














To check if the dictionary is listed in the path run hunspell -D.
It should output something along those lines:



...
/usr/share/hunspell/en_US
/usr/share/hunspell/de_BE
/usr/share/hunspell/de_LU
/usr/share/hunspell/de_DE
...


Next, add your preferred dictionaries to ispell-local-dictionary-alist in your .emacs file



(add-to-list 'ispell-local-dictionary-alist '("deutsch-hunspell"
"[[:alpha:]]"
"[^[:alpha:]]"
"[']"
t
("-d" "de_DE"); Dictionary file name
nil
iso-8859-1))

(add-to-list 'ispell-local-dictionary-alist '("english-hunspell"
"[[:alpha:]]"
"[^[:alpha:]]"
"[']"
t
("-d" "en_US")
nil
iso-8859-1))

(setq ispell-program-name "hunspell" ; Use hunspell to correct mistakes
ispell-dictionary "deutsch-hunspell") ; Default dictionary to use


In addition to that you can define a function to switch between the german and english dictionaries and bind it to C-c d for example



(defun switch-dictionary-de-en ()
"Switch german and english dictionaries."
(interactive)
(let* ((dict ispell-current-dictionary)
(new (if (string= dict "deutsch-hunspell") "english-hunspell"
"deutsch-hunspell")))
(ispell-change-dictionary new)
(message "Switched dictionary from %s to %s" dict new)))

(global-set-key (kbd "C-c d") 'switch-dictionary-de-en)





share|improve this answer


















  • 4





    Thanks. I think you should add a (require 'ispell) before the (add-to-list 'ispell-local...) line.

    – student
    Apr 23 '14 at 21:07






  • 1





    I think it will not hurt if I add a little comment for those Windows users who might fall on this. In Windows Emacs has the LANG environment variable set to the regional settings. It is a good idea to add something like (setenv "LANG" "en_US") to your init file. This will be your initial dictionary, unless you change it. The default LANG value might be set to something possibly weird (say ENG), generating an ispell/hunspell error.

    – antonio
    Dec 26 '14 at 18:02











  • @antonio True, but in my case, (setenv "DICTIONARY" "en_GB") worked.

    – legends2k
    Oct 19 '15 at 14:59












  • The creation of custom dictionary entries for hunspell is not required for emacs > 24.

    – Christian Herenz
    Nov 26 '18 at 19:45


















0














From https://passingcuriosity.com/2017/emacs-hunspell-and-dictionaries/




Add



;; Set $DICPATH to "$HOME/Library/Spelling" for hunspell.
(setenv
"DICPATH"
"/path/to/hunspell/dictionary")
;; Tell ispell-mode to use hunspell.
(setq
ispell-program-name
"hunspell")


into your ~/.emacs.




My dictionary files were at /usr/share/hunspell.






share|improve this answer






















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f86554%2fmake-hunspell-work-with-emacs-and-german-language%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    To check if the dictionary is listed in the path run hunspell -D.
    It should output something along those lines:



    ...
    /usr/share/hunspell/en_US
    /usr/share/hunspell/de_BE
    /usr/share/hunspell/de_LU
    /usr/share/hunspell/de_DE
    ...


    Next, add your preferred dictionaries to ispell-local-dictionary-alist in your .emacs file



    (add-to-list 'ispell-local-dictionary-alist '("deutsch-hunspell"
    "[[:alpha:]]"
    "[^[:alpha:]]"
    "[']"
    t
    ("-d" "de_DE"); Dictionary file name
    nil
    iso-8859-1))

    (add-to-list 'ispell-local-dictionary-alist '("english-hunspell"
    "[[:alpha:]]"
    "[^[:alpha:]]"
    "[']"
    t
    ("-d" "en_US")
    nil
    iso-8859-1))

    (setq ispell-program-name "hunspell" ; Use hunspell to correct mistakes
    ispell-dictionary "deutsch-hunspell") ; Default dictionary to use


    In addition to that you can define a function to switch between the german and english dictionaries and bind it to C-c d for example



    (defun switch-dictionary-de-en ()
    "Switch german and english dictionaries."
    (interactive)
    (let* ((dict ispell-current-dictionary)
    (new (if (string= dict "deutsch-hunspell") "english-hunspell"
    "deutsch-hunspell")))
    (ispell-change-dictionary new)
    (message "Switched dictionary from %s to %s" dict new)))

    (global-set-key (kbd "C-c d") 'switch-dictionary-de-en)





    share|improve this answer


















    • 4





      Thanks. I think you should add a (require 'ispell) before the (add-to-list 'ispell-local...) line.

      – student
      Apr 23 '14 at 21:07






    • 1





      I think it will not hurt if I add a little comment for those Windows users who might fall on this. In Windows Emacs has the LANG environment variable set to the regional settings. It is a good idea to add something like (setenv "LANG" "en_US") to your init file. This will be your initial dictionary, unless you change it. The default LANG value might be set to something possibly weird (say ENG), generating an ispell/hunspell error.

      – antonio
      Dec 26 '14 at 18:02











    • @antonio True, but in my case, (setenv "DICTIONARY" "en_GB") worked.

      – legends2k
      Oct 19 '15 at 14:59












    • The creation of custom dictionary entries for hunspell is not required for emacs > 24.

      – Christian Herenz
      Nov 26 '18 at 19:45















    4














    To check if the dictionary is listed in the path run hunspell -D.
    It should output something along those lines:



    ...
    /usr/share/hunspell/en_US
    /usr/share/hunspell/de_BE
    /usr/share/hunspell/de_LU
    /usr/share/hunspell/de_DE
    ...


    Next, add your preferred dictionaries to ispell-local-dictionary-alist in your .emacs file



    (add-to-list 'ispell-local-dictionary-alist '("deutsch-hunspell"
    "[[:alpha:]]"
    "[^[:alpha:]]"
    "[']"
    t
    ("-d" "de_DE"); Dictionary file name
    nil
    iso-8859-1))

    (add-to-list 'ispell-local-dictionary-alist '("english-hunspell"
    "[[:alpha:]]"
    "[^[:alpha:]]"
    "[']"
    t
    ("-d" "en_US")
    nil
    iso-8859-1))

    (setq ispell-program-name "hunspell" ; Use hunspell to correct mistakes
    ispell-dictionary "deutsch-hunspell") ; Default dictionary to use


    In addition to that you can define a function to switch between the german and english dictionaries and bind it to C-c d for example



    (defun switch-dictionary-de-en ()
    "Switch german and english dictionaries."
    (interactive)
    (let* ((dict ispell-current-dictionary)
    (new (if (string= dict "deutsch-hunspell") "english-hunspell"
    "deutsch-hunspell")))
    (ispell-change-dictionary new)
    (message "Switched dictionary from %s to %s" dict new)))

    (global-set-key (kbd "C-c d") 'switch-dictionary-de-en)





    share|improve this answer


















    • 4





      Thanks. I think you should add a (require 'ispell) before the (add-to-list 'ispell-local...) line.

      – student
      Apr 23 '14 at 21:07






    • 1





      I think it will not hurt if I add a little comment for those Windows users who might fall on this. In Windows Emacs has the LANG environment variable set to the regional settings. It is a good idea to add something like (setenv "LANG" "en_US") to your init file. This will be your initial dictionary, unless you change it. The default LANG value might be set to something possibly weird (say ENG), generating an ispell/hunspell error.

      – antonio
      Dec 26 '14 at 18:02











    • @antonio True, but in my case, (setenv "DICTIONARY" "en_GB") worked.

      – legends2k
      Oct 19 '15 at 14:59












    • The creation of custom dictionary entries for hunspell is not required for emacs > 24.

      – Christian Herenz
      Nov 26 '18 at 19:45













    4












    4








    4







    To check if the dictionary is listed in the path run hunspell -D.
    It should output something along those lines:



    ...
    /usr/share/hunspell/en_US
    /usr/share/hunspell/de_BE
    /usr/share/hunspell/de_LU
    /usr/share/hunspell/de_DE
    ...


    Next, add your preferred dictionaries to ispell-local-dictionary-alist in your .emacs file



    (add-to-list 'ispell-local-dictionary-alist '("deutsch-hunspell"
    "[[:alpha:]]"
    "[^[:alpha:]]"
    "[']"
    t
    ("-d" "de_DE"); Dictionary file name
    nil
    iso-8859-1))

    (add-to-list 'ispell-local-dictionary-alist '("english-hunspell"
    "[[:alpha:]]"
    "[^[:alpha:]]"
    "[']"
    t
    ("-d" "en_US")
    nil
    iso-8859-1))

    (setq ispell-program-name "hunspell" ; Use hunspell to correct mistakes
    ispell-dictionary "deutsch-hunspell") ; Default dictionary to use


    In addition to that you can define a function to switch between the german and english dictionaries and bind it to C-c d for example



    (defun switch-dictionary-de-en ()
    "Switch german and english dictionaries."
    (interactive)
    (let* ((dict ispell-current-dictionary)
    (new (if (string= dict "deutsch-hunspell") "english-hunspell"
    "deutsch-hunspell")))
    (ispell-change-dictionary new)
    (message "Switched dictionary from %s to %s" dict new)))

    (global-set-key (kbd "C-c d") 'switch-dictionary-de-en)





    share|improve this answer













    To check if the dictionary is listed in the path run hunspell -D.
    It should output something along those lines:



    ...
    /usr/share/hunspell/en_US
    /usr/share/hunspell/de_BE
    /usr/share/hunspell/de_LU
    /usr/share/hunspell/de_DE
    ...


    Next, add your preferred dictionaries to ispell-local-dictionary-alist in your .emacs file



    (add-to-list 'ispell-local-dictionary-alist '("deutsch-hunspell"
    "[[:alpha:]]"
    "[^[:alpha:]]"
    "[']"
    t
    ("-d" "de_DE"); Dictionary file name
    nil
    iso-8859-1))

    (add-to-list 'ispell-local-dictionary-alist '("english-hunspell"
    "[[:alpha:]]"
    "[^[:alpha:]]"
    "[']"
    t
    ("-d" "en_US")
    nil
    iso-8859-1))

    (setq ispell-program-name "hunspell" ; Use hunspell to correct mistakes
    ispell-dictionary "deutsch-hunspell") ; Default dictionary to use


    In addition to that you can define a function to switch between the german and english dictionaries and bind it to C-c d for example



    (defun switch-dictionary-de-en ()
    "Switch german and english dictionaries."
    (interactive)
    (let* ((dict ispell-current-dictionary)
    (new (if (string= dict "deutsch-hunspell") "english-hunspell"
    "deutsch-hunspell")))
    (ispell-change-dictionary new)
    (message "Switched dictionary from %s to %s" dict new)))

    (global-set-key (kbd "C-c d") 'switch-dictionary-de-en)






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Feb 2 '14 at 20:12









    stkstk

    913




    913







    • 4





      Thanks. I think you should add a (require 'ispell) before the (add-to-list 'ispell-local...) line.

      – student
      Apr 23 '14 at 21:07






    • 1





      I think it will not hurt if I add a little comment for those Windows users who might fall on this. In Windows Emacs has the LANG environment variable set to the regional settings. It is a good idea to add something like (setenv "LANG" "en_US") to your init file. This will be your initial dictionary, unless you change it. The default LANG value might be set to something possibly weird (say ENG), generating an ispell/hunspell error.

      – antonio
      Dec 26 '14 at 18:02











    • @antonio True, but in my case, (setenv "DICTIONARY" "en_GB") worked.

      – legends2k
      Oct 19 '15 at 14:59












    • The creation of custom dictionary entries for hunspell is not required for emacs > 24.

      – Christian Herenz
      Nov 26 '18 at 19:45












    • 4





      Thanks. I think you should add a (require 'ispell) before the (add-to-list 'ispell-local...) line.

      – student
      Apr 23 '14 at 21:07






    • 1





      I think it will not hurt if I add a little comment for those Windows users who might fall on this. In Windows Emacs has the LANG environment variable set to the regional settings. It is a good idea to add something like (setenv "LANG" "en_US") to your init file. This will be your initial dictionary, unless you change it. The default LANG value might be set to something possibly weird (say ENG), generating an ispell/hunspell error.

      – antonio
      Dec 26 '14 at 18:02











    • @antonio True, but in my case, (setenv "DICTIONARY" "en_GB") worked.

      – legends2k
      Oct 19 '15 at 14:59












    • The creation of custom dictionary entries for hunspell is not required for emacs > 24.

      – Christian Herenz
      Nov 26 '18 at 19:45







    4




    4





    Thanks. I think you should add a (require 'ispell) before the (add-to-list 'ispell-local...) line.

    – student
    Apr 23 '14 at 21:07





    Thanks. I think you should add a (require 'ispell) before the (add-to-list 'ispell-local...) line.

    – student
    Apr 23 '14 at 21:07




    1




    1





    I think it will not hurt if I add a little comment for those Windows users who might fall on this. In Windows Emacs has the LANG environment variable set to the regional settings. It is a good idea to add something like (setenv "LANG" "en_US") to your init file. This will be your initial dictionary, unless you change it. The default LANG value might be set to something possibly weird (say ENG), generating an ispell/hunspell error.

    – antonio
    Dec 26 '14 at 18:02





    I think it will not hurt if I add a little comment for those Windows users who might fall on this. In Windows Emacs has the LANG environment variable set to the regional settings. It is a good idea to add something like (setenv "LANG" "en_US") to your init file. This will be your initial dictionary, unless you change it. The default LANG value might be set to something possibly weird (say ENG), generating an ispell/hunspell error.

    – antonio
    Dec 26 '14 at 18:02













    @antonio True, but in my case, (setenv "DICTIONARY" "en_GB") worked.

    – legends2k
    Oct 19 '15 at 14:59






    @antonio True, but in my case, (setenv "DICTIONARY" "en_GB") worked.

    – legends2k
    Oct 19 '15 at 14:59














    The creation of custom dictionary entries for hunspell is not required for emacs > 24.

    – Christian Herenz
    Nov 26 '18 at 19:45





    The creation of custom dictionary entries for hunspell is not required for emacs > 24.

    – Christian Herenz
    Nov 26 '18 at 19:45













    0














    From https://passingcuriosity.com/2017/emacs-hunspell-and-dictionaries/




    Add



    ;; Set $DICPATH to "$HOME/Library/Spelling" for hunspell.
    (setenv
    "DICPATH"
    "/path/to/hunspell/dictionary")
    ;; Tell ispell-mode to use hunspell.
    (setq
    ispell-program-name
    "hunspell")


    into your ~/.emacs.




    My dictionary files were at /usr/share/hunspell.






    share|improve this answer



























      0














      From https://passingcuriosity.com/2017/emacs-hunspell-and-dictionaries/




      Add



      ;; Set $DICPATH to "$HOME/Library/Spelling" for hunspell.
      (setenv
      "DICPATH"
      "/path/to/hunspell/dictionary")
      ;; Tell ispell-mode to use hunspell.
      (setq
      ispell-program-name
      "hunspell")


      into your ~/.emacs.




      My dictionary files were at /usr/share/hunspell.






      share|improve this answer

























        0












        0








        0







        From https://passingcuriosity.com/2017/emacs-hunspell-and-dictionaries/




        Add



        ;; Set $DICPATH to "$HOME/Library/Spelling" for hunspell.
        (setenv
        "DICPATH"
        "/path/to/hunspell/dictionary")
        ;; Tell ispell-mode to use hunspell.
        (setq
        ispell-program-name
        "hunspell")


        into your ~/.emacs.




        My dictionary files were at /usr/share/hunspell.






        share|improve this answer













        From https://passingcuriosity.com/2017/emacs-hunspell-and-dictionaries/




        Add



        ;; Set $DICPATH to "$HOME/Library/Spelling" for hunspell.
        (setenv
        "DICPATH"
        "/path/to/hunspell/dictionary")
        ;; Tell ispell-mode to use hunspell.
        (setq
        ispell-program-name
        "hunspell")


        into your ~/.emacs.




        My dictionary files were at /usr/share/hunspell.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 23 '17 at 22:10









        Raniere SilvaRaniere Silva

        101




        101



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f86554%2fmake-hunspell-work-with-emacs-and-german-language%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay