how to get GNU Emacs spellcheck to find user's personal dictionary on OSX?

二次信任 提交于 2019-12-12 19:08:47

问题


I switched from Aquamacs to GNU Emacs. Before, when Aquamacs thought a word was misspelled, I could right-click to "Learn Spelling." (I also had an option to Ignore Spelling to get it to unflag the word for that buffer only.)

In GNU Emacs, I'm using flyspell-mode with ispell, with aspell as the dictionary. But I notice that the words I previously added to my dictionary (e.g. my name) are getting flagged as misspelled.

How do I get GNU Emacs to find and use the personal word list I've already built up? Can I do this without, for example, building Aquamacs from source?


回答1:


Here are my notes on setting up Aspell for OSX and Windows -- instructions for setting up the user personal dictionary are set forth in the thread of that link:

https://stackoverflow.com/a/20013202/2112489

The personal word list in Aspell is a flat text file that contains contents that looks like this, and you can insert any word manually -- including, but not limited to copying over the contents of your list from the native OSX spellchecker ~/Library/Spelling/LocalDictionary:

personal_ws-1.1 en 79 
lawlist
realleges
parte

And, in my .emacs, I use (adjust your own path accordingly):

(require 'ispell)
(require 'flyspell)
(setq-default ispell-program-name "/Users/HOME/.0.data/.0.emacs/elpa/bin/aspell")
(setq flyspell-default-dictionary "english")
(setq ispell-dictionary "english")

This is a function I use to switch between Spanish and English:

(defun spell (choice)
   "Switch between language dictionaries."
   (interactive "cChoose:  (1) English | (2) Español")
    (cond ((eq choice ?1)
           (setq flyspell-default-dictionary "english")
           (setq ispell-dictionary "english")
           (setq ispell-personal-dictionary "/Users/HOME/.0.data/.0.emacs/.aspell.en.pws")
           (ispell-kill-ispell))
          ((eq choice ?2)
           (setq flyspell-default-dictionary "spanish")
           (setq ispell-dictionary "spanish")
           (setq ispell-personal-dictionary "/Users/HOME/.0.data/.0.emacs/.aspell.es.pws")
           (ispell-kill-ispell))
          (t (message "No changes have been made."))) )

For Windows, I use:

(setq-default ispell-program-name "c:/Program Files/Aspell/bin/aspell.exe")


来源:https://stackoverflow.com/questions/22189522/how-to-get-gnu-emacs-spellcheck-to-find-users-personal-dictionary-on-osx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!