Skip to content

purcell/osx-dictionary.el

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 

Repository files navigation

OSX Dictionary.app interface for Emacs


Introduction

osx-dictionary.el is inspired by dictionary.vim. osx-dictionary.el provides functions which invoke Dictionary.app from Mac OS X.

Notes: translation between Chinese and English is well supported.

Prerequisite

GNU Emacs doesn't know much about Chinese, for example, it can't not guess most likely meaningful Chinese word under current cursor. 结巴中文分词 is used for this task.

If you don't want to use 结巴中文分词, just customize osx-dictionary-chinese-wordsplit-command to "".

Installation

  1. Clone this repository

    $ git clone https://github.com/xuchunyang/osx-dictionary.el
    $ cd osx-dictionary.el
  2. Compile & install osx-dictionary

    $ clang -O3 -framework CoreServices -framework Foundation osx-dictionary.m -o osx-dictionary
    $ sudo mv osx-dictionary /usr/local/bin

    osx-dictionary is a simple CommandLine utility to access Dictionary.app

  3. Put osx-dictionary.el/ to your load-path and add the following to your Emacs initialization file

    (require osx-'dictionary)
    ;; Example key binding
    (global-set-key (kbd "C-c d") 'osx-dictionary-search-pointer)
    (global-set-key (kbd "C-c c") 'osx-dictionary-search-word)

Usage

Below are commands you can use:

  • osx-dictionary-search-word Search word from input
  • osx-dictionary-search-pointerSearch word at point

Here is a screenshot of a sample usage: Imgur

Todo

  • Save search history
  • Improve regex for highlight
    • Add more keywords, for example, "名" and "代"
    • Adopt more precise matching
  • Use Chinese text segmentation for better Chinese translation

About

Mac OS X Dictionary.app interface for Emacs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Emacs Lisp 58.5%
  • MATLAB 41.5%