Make checkdoc and package linter happy

This commit is contained in:
Adam Kruszewski 2023-07-03 16:01:07 +02:00
parent b5b2b4c498
commit 4f9d20a47f

View file

@ -1,16 +1,16 @@
;;; cape-jinx-completion.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) 2021-2023 Adam Kruszewski
;; 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: 1.0 ;; Version: 1.0
;; Package-Requires: ((emacs "27.1") (compat "29.1.4.0") (cape "0.15") (jinx "0.5")) ;; Package-Requires: ((emacs "28.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: convenience, completion, spell-check
;; This file is part of GNU Emacs. ;; This file is not part of GNU Emacs.
;; This program is free software: you can redistribute it and/or modify ;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by ;; it under the terms of the GNU General Public License as published by
@ -35,14 +35,17 @@
;; and C module bridge 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-completion)
;; cape-jinx-completion to your completions-at-point-functions. ;; cape-jinx-completion to your completions-at-point-functions.
;;; Code:
(require 'cape) (require 'cape)
(require 'jinx) (require 'jinx)
;; jinx.el version 0.5 is required ;; jinx.el version 0.5 is required
(defun jinx-suggest-for-word (word) (defun cape-jinx-completion-suggest-for-word (word)
"Return suggestions as a list for `WORD'."
(when (not jinx--dicts) (when (not jinx--dicts)
(when (not (fboundp #'jinx--mod-dict)) (when (not (fboundp #'jinx--mod-dict))
(jinx--load-module)) (jinx--load-module))
@ -54,53 +57,53 @@
(cl-pushnew el result)))) (cl-pushnew el result))))
(delete-dups result))) (delete-dups result)))
;; cape-jinx (based on cape-dict) ;; cape-jinx-completion (based on cape-dict)
(defgroup cape-jinx nil (defgroup cape-jinx-completion nil
"Completion At Point extensions using Jinx spell checking." "Completion At Point extensions using Jinx spell checking."
:prefix "cape-jinx" :prefix "cape-jinx-completion"
:group 'cape-jinx) :group 'cape-jinx-completion)
(defcustom cape-jinx-case-replace 'case-replace (defcustom cape-jinx-completion-case-replace 'case-replace
"Preserve case of input. "Preserve case of input.
See `dabbrev-case-replace' for details." See `dabbrev-case-replace' for details."
:type '(choice (const :tag "off" nil) :type '(choice (const :tag "off" nil)
(const :tag "use `case-replace'" case-replace) (const :tag "use `case-replace'" case-replace)
(other :tag "on" t))) (other :tag "on" t)))
(defcustom cape-jinx-case-fold 'case-fold-search (defcustom cape-jinx-completion-case-fold 'case-fold-search
"Case fold search during search. "Case fold search during search.
See `dabbrev-case-fold-search' for details." See `dabbrev-case-fold-search' for details."
:type '(choice (const :tag "off" nil) :type '(choice (const :tag "off" nil)
(const :tag "use `case-fold-search'" case-fold-search) (const :tag "use `case-fold-search'" case-fold-search)
(other :tag "on" t))) (other :tag "on" t)))
(defvar cape--jinx-properties (defvar cape-jinx-completion--properties
(list :annotation-function (lambda (_) " Jinx") (list :annotation-function (lambda (_) " Jinx")
:company-kind (lambda (_) 'text) :company-kind (lambda (_) 'text)
:exclusive 'no) :exclusive 'no)
"Completion extra properties for `cape-jinx'.") "Completion extra properties for `cape-jinx-completion'.")
(defun cape--jinx-list (input) (defun cape-jinx-completion--list (input)
"Return all words from Jinx spell checking mechanism matching INPUT." "Return all words from Jinx spell checking mechanism matching INPUT."
(unless (equal input "") (unless (equal input "")
(cape--case-replace-list (cape--case-replace-list
cape-jinx-case-replace input cape-jinx-completion-case-replace input
(jinx-suggest-for-word input)))) (cape-jinx-completion-suggest-for-word input))))
;;;###autoload ;;;###autoload
(defun cape-jinx (&optional interactive) (defun cape-jinx-completion (&optional interactive)
"Complete word from Jinx spell checking at point. "Complete word from Jinx spell checking at point.
If INTERACTIVE is nil the function acts like a Capf." If INTERACTIVE is nil the function acts like a Capf."
(interactive (list t)) (interactive (list t))
(if interactive (if interactive
(cape-interactive #'cape-jinx) (cape-interactive #'cape-jinx-completion)
(pcase-let ((`(,beg . ,end) (cape--bounds 'word))) (pcase-let ((`(,beg . ,end) (cape--bounds 'word)))
`(,beg ,end `(,beg ,end
,(cape--table-with-properties ,(cape--table-with-properties
(completion-table-case-fold (completion-table-case-fold
(cape--cached-table beg end #'cape--jinx-list #'string-search) (cape--cached-table beg end #'cape-jinx-completion--list #'string-search)
(not (cape--case-fold-p cape-jinx-case-fold))) (not (cape--case-fold-p cape-jinx-completion-case-fold)))
:category 'cape-jinx) :category 'cape-jinx-completion)
,@cape--jinx-properties)))) ,@cape--jinx-properties))))
;;; cape-jinx-completion.el ends here ;;; cape-jinx-completion.el ends here