Added readme file
also fixed some minor issues and polished some comments.
This commit is contained in:
parent
099d45b5fb
commit
46b5d9c9ea
3 changed files with 68 additions and 9 deletions
|
@ -1,11 +1,11 @@
|
||||||
;;; cape-jinx.el --- Completion At Point Extensions using Jinx spell checking -*- lexical-binding: t -*-
|
;;; cape-jinx-completion.el --- Completion At Point Extensions using Jinx spell checking -*- lexical-binding: t -*-
|
||||||
|
|
||||||
;; Copyright (C) 2023 Free Software Foundation, Inc.
|
;; Copyright (C) 2023 Free Software Foundation, Inc.
|
||||||
|
|
||||||
;; Author: Adam Kruszewski <adam@kruszewski.name>
|
;; Author: Adam Kruszewski <adam@kruszewski.name>
|
||||||
;; Maintainer: Adam Kruszewski <adam@kruszewski.name>
|
;; Maintainer: Adam Kruszewski <adam@kruszewski.name>
|
||||||
;; Created: 2023
|
;; Created: 2023
|
||||||
;; Version: 0.5
|
;; Version: 1.0
|
||||||
;; Package-Requires: ((emacs "27.1") (compat "29.1.4.0") (cape "0.15") (jinx "0.5"))
|
;; Package-Requires: ((emacs "27.1") (compat "29.1.4.0") (cape "0.15") (jinx "0.5"))
|
||||||
;; Homepage: https://code.bsdgeek.org/adam/cape-jinx-completion
|
;; Homepage: https://code.bsdgeek.org/adam/cape-jinx-completion
|
||||||
;; Keywords: completion, spell-check
|
;; Keywords: completion, spell-check
|
||||||
|
@ -27,20 +27,21 @@
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;; Additional completion backend in the form of Capfs
|
;; Additional completion backend in the form of Capfs
|
||||||
;; (completion-at-point-functions), using underlying C module distributed
|
;; (completion-at-point-functions), using underlying C module provided
|
||||||
;; with Jinx just-in-time spell-checking package
|
;; by Jinx just-in-time spell-checking package
|
||||||
;; (see https://github.com/minad/jinx ).
|
;; (see https://github.com/minad/jinx ).
|
||||||
;;
|
;;
|
||||||
;; It doesn't need Jinx enabled, but it uses its configuration
|
;; It doesn't need Jinx enabled, but it uses its configuration
|
||||||
;; and C module bride to enchant library.
|
;; and C module bridge to enchant library.
|
||||||
;;
|
;;
|
||||||
;; Having jinx and cape configured you just need to add:
|
;; Having jinx and cape configured you just need to add:
|
||||||
;; (add-to-list 'completion-at-point-functions #'cape-jinx)
|
;; (add-to-list 'completion-at-point-functions #'cape-jinx)
|
||||||
;; cape-jinx completions to your completions-at-point-functions.
|
;; cape-jinx-completion to your completions-at-point-functions.
|
||||||
|
|
||||||
(require 'cape)
|
(require 'cape)
|
||||||
|
(require 'jinx)
|
||||||
|
|
||||||
;; jinx.el version 0.5 required
|
;; jinx.el version 0.5 is required
|
||||||
(defun jinx-suggest-for-word (word)
|
(defun jinx-suggest-for-word (word)
|
||||||
(when (not jinx--dicts)
|
(when (not jinx--dicts)
|
||||||
(when (not (fboundp #'jinx--mod-dict))
|
(when (not (fboundp #'jinx--mod-dict))
|
||||||
|
@ -53,7 +54,12 @@
|
||||||
(cl-pushnew el result))))
|
(cl-pushnew el result))))
|
||||||
(delete-dups result)))
|
(delete-dups result)))
|
||||||
|
|
||||||
;; cape-jinx (based verbatim on cape-dict)
|
;; cape-jinx (based on cape-dict)
|
||||||
|
(defgroup cape-jinx nil
|
||||||
|
"Completion At Point extensions using Jinx spell checking."
|
||||||
|
:prefix "cape-jinx"
|
||||||
|
:group 'cape-jinx)
|
||||||
|
|
||||||
(defcustom cape-jinx-case-replace 'case-replace
|
(defcustom cape-jinx-case-replace 'case-replace
|
||||||
"Preserve case of input.
|
"Preserve case of input.
|
||||||
See `dabbrev-case-replace' for details."
|
See `dabbrev-case-replace' for details."
|
||||||
|
@ -97,4 +103,4 @@
|
||||||
:category 'cape-jinx)
|
:category 'cape-jinx)
|
||||||
,@cape--jinx-properties))))
|
,@cape--jinx-properties))))
|
||||||
|
|
||||||
(provide 'cape-jinx)
|
(provide 'cape-jinx-completion)
|
BIN
readme-images/cape-jinx.png
Executable file
BIN
readme-images/cape-jinx.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 9.8 KiB |
53
readme.org
Normal file
53
readme.org
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
#+TITLE: Completion At Point extensions using Jinx spell checking
|
||||||
|
|
||||||
|
* Cape-jinx package
|
||||||
|
Simple package providing =completion-at-point= extension using spell checking capabilities derived from [[https://abiword.github.io/enchant/][Abiword's libenchant]]. All of the heavy lifting is done using [[https://github.com/minad/jinx][jinx.el]] package - Enchanted Spell Checker.
|
||||||
|
|
||||||
|
[[https://abiword.github.io/enchant/][Libenchant]] wraps several of the spell checkers. [[https://github.com/minad/jinx][Jinx.el]] package provides on-the-fly spell checking and is a pleasure to configure, especially when using multiple dictionaries.
|
||||||
|
|
||||||
|
** Picture is worth a thousand words
|
||||||
|
Completion candidates using spell checker:
|
||||||
|
|
||||||
|
[[./readme-images/cape-jinx.png]]
|
||||||
|
|
||||||
|
* Installation instructions
|
||||||
|
** Requirements
|
||||||
|
[[https://github.com/minad/cape][cape.el]] - Completion At Point Extensions. [[https://github.com/minad/jinx][Jinx.el]] version at least 0.5 is required. Jinx requires =libenchant= installed in the system and at least one of the supported spell checkers (hunspell, Nuspell, GNU aspell) and dictionaries you want to use.
|
||||||
|
|
||||||
|
** Using straight.el
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
;; First we need to configure jinx. You don't need to enable jinx-mode to use cape-jinx,
|
||||||
|
;; but you need to provide configuration and set up dictionaries to use.
|
||||||
|
(use-package jinx
|
||||||
|
:straight (:host github :repo "minad/jinx" :files ("*"))
|
||||||
|
:config
|
||||||
|
;; Add unicode stuff I need to exclude from spell-checking (emojis, symbols, etc)
|
||||||
|
(push "[\U00002600-\U0001ffff]"
|
||||||
|
(alist-get t jinx-exclude-regexps))
|
||||||
|
;; set langauge dictionaries to use - the list is space seprated in a single string.
|
||||||
|
(setq jinx-languages "pl en"))
|
||||||
|
|
||||||
|
;; Cape-jinx package and configuration:
|
||||||
|
(use-package cape-jinx-completion
|
||||||
|
:straight (:type git
|
||||||
|
:repo "https://code.bsdgeek.org/adam/cape-jinx-completion"
|
||||||
|
:files (:defaults "*.el"))
|
||||||
|
:after jinx
|
||||||
|
:config
|
||||||
|
;; add cape-jinx to completion-at-point functions list.
|
||||||
|
(add-to-list 'completion-at-point-functions #'cape-jinx))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
* Customization
|
||||||
|
Options available to customize are literally copied from =cape-dict= and work exactly the same way.
|
||||||
|
- =cape-jinx-case-replace=
|
||||||
|
Controls whether case of input be preserved.
|
||||||
|
- =cape-jinx-case-fold=
|
||||||
|
Controls whether case fold search should be used during search.
|
||||||
|
|
||||||
|
* How to contribute
|
||||||
|
The latest source code is available at https://code.bsdgeek.org/adam/cape-jinx-completion
|
||||||
|
|
||||||
|
Issue reports, questions, comments and code patches are welcome -- you can send them to me over e-mail at adam /at/ kruszewski /dot/ name (please be patient as I'm not checking this account on a daily basis).
|
||||||
|
|
||||||
|
If you haven't sent code patches via e-mail yet and would like to learn how to work with an e-mail based workflow, you can read more at [[https://git-scm.com/docs/git-format-patch][git format-patch]] man page or at [[https://git-send-email.io/][git-send-email.io]].
|
Loading…
Reference in a new issue