Code Monkey home page Code Monkey logo

nsspell-emacs's Introduction

nsspell is an Emacs package for interacting with the macOS spell checker. It makes use of the new dynamic module system for Emacs 25 in order to interface with the relevant Objective-C APIs.

The project is in an early, proof-of-concept stage. For those hoping to see a fully-formed, drop-in replacement for flyspell, prepare to be disappointed.

One observation I will make is that that the Objective-C API is so very different from ispell, aspell, or hunspell that it makes writing a simple backend for ispell.el very difficult. However, I think that it also has the potential to make a more versatile and performant spell checker, since it is possible to check more than one word at a time.

Examples

The API currently looks as follows:

(require 'nsspell)

;; Check if the dynamic module has loaded correctly.
(nsspell-is-available-p)
	=> t

;; Check that a Canadian English dictionary is available.
(nsspell-dictionary-p "en_CA")
	=> t

;; Spell checking interface.
(nsspell-check-word "piano") ;; Use default dictionary.
	=> t
(nsspell-check-word "helli" "en_CA")
	=> ("hello" "hell" "hells" "belli" "elli")

;; List suggestions for any word.
(nsspell-suggestions-for "helli")
	=> ("hello" "hell" "hells" "belli" "elli")
(nsspell-suggestions-for "hello" "en_CA")
	=> ("hell" "hells" "hallo" "jello" "hellos" ...)

Notice that it is happy to make suggestions for words that are notionally spelled correctly...

Installation

This package is not available on MELPA or any of the other Emacs package repositories. I am unsure how/when/if dynamic modules containing native code would be distributed through these repositories. For now, you will have to clone this repository and build the artifact yourself, and then make it available in Emacs's load path.

There is a Makefile provided, so you should be able to run a simple make to build the dynamic module. There is also an easy-to-use make test target that will check if it is working.

In order to make this package work, you need (a) to be on Mac OS X, and (b) to have a version of Emacs that supports dynamic modules. If you are unsure of the latter, you can check whether the symbol module-file-suffix is bound and not nil, or run the following make target from this repository:

$ make module-support-test

which will echo something brief but helpful.

If your version of Emacs does not support dynamic modules, you will need to install one that does. The development release 25.0.95 does have optional support, if you pass the --with-modules flag to the ./configure script during compilation.

For those that are intimidated by the thought of compiling Emacs themselves: I have submitted a pull request to Homebrew to make building a dynamic module-supporting version of Emacs easier.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.