xuchunyang / osx-dictionary.el

Mac OS X Dictionary.app interface for Emacs
139 stars 23 forks source link

Dictionary choice #7

Closed jagrg closed 7 years ago

jagrg commented 9 years ago

I tried running 'osx-dictionary-cli' -l'`, but it didn't work. Could you maybe be more specific on how I can do this?

xuchunyang commented 9 years ago

osx-dictionary-cli is not in your PATH by default, so you have to locate it manually and then invoke like this way:

~ $ cd ~/.emacs.d/elpa/osx-dictionary-20150317.1029/

~/.emacs.d/elpa/osx-dictionary-20150317.1029 $ ./osx-dictionary-cli -l
Simplified Chinese - English
Apple
Korean
Dutch
Wikipedia
American English Thesaurus
Simplified Chinese
Spanish
朗道汉英字典5.0
Thai
Japanese
Italian
Turkish
Japanese-English
Korean - English
Portuguese
German
British English Thesaurus
Spanish - English
French
Russian
British English
American English
jagrg commented 9 years ago

It worked, thanks! Now, some of the dictionaries have similar names. For example, "Oxford Dictionary of English" and "New Oxford American Dictionary" both show up as "Dictionary". I know I could manually delete the "duplicates", but is there an alternative solution?

xuchunyang commented 9 years ago

Sorry for my late response.

Which version is your Mac OS X?

I'm on Mac OS X 10.10 and don't notice the problem you described, on my side, "Oxford Dictionary of English" => "British English" and "New Oxford American Dictionary" => "American English". I also don't find any other duplicates.

Choosing a specific Dictionary requires some private (undocumented) Dictionary APIs, these APis are not as reliable as public API. If you prefer some dictionaries, you can choose them and arrange their order from Dictionary.app's Preferences interface, instead of choosing one specific from osx-dictionary.el, osx-dictionary.el will use the first available dictionary among them by calling a public API.

Hope that helps

jagrg commented 9 years ago

I'm on 10.9, so that explains. What I wanted was a solution to switch between dictionaries, so I ended up doing this

(defadvice osx-dictionary-second-dictionary-search-pointer (around osx-dictionary-dictionary-choice)
  (let ((osx-dictionary-dictionary-choice "Aurélio"))
    ad-do-it))

(defun osx-dictionary-second-dictionary-search-pointer ()
  (interactive)
  (osx-dictionary-search-pointer))
xuchunyang commented 7 years ago

The Dictionary choice support has been dropped for macOS Sierra support. If you use older version of Mac OS and need Dictionary choice support, please use v0.2.2. Sorry for the inconvenience.