From 4f9d20a47fa14c26497f9492af733516ddf11908 Mon Sep 17 00:00:00 2001 From: Adam Kruszewski Date: Mon, 3 Jul 2023 16:01:07 +0200 Subject: [PATCH] Make checkdoc and package linter happy --- cape-jinx-completion.el | 53 ++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/cape-jinx-completion.el b/cape-jinx-completion.el index 2b2957e..4082b07 100644 --- a/cape-jinx-completion.el +++ b/cape-jinx-completion.el @@ -1,16 +1,16 @@ ;;; 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 ;; Maintainer: Adam Kruszewski ;; Created: 2023 ;; 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 -;; 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 ;; it under the terms of the GNU General Public License as published by @@ -35,14 +35,17 @@ ;; and C module bridge to enchant library. ;; ;; 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. +;;; Code: + (require 'cape) (require 'jinx) ;; 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 (fboundp #'jinx--mod-dict)) (jinx--load-module)) @@ -54,53 +57,53 @@ (cl-pushnew el result)))) (delete-dups result))) -;; cape-jinx (based on cape-dict) -(defgroup cape-jinx nil +;; cape-jinx-completion (based on cape-dict) +(defgroup cape-jinx-completion nil "Completion At Point extensions using Jinx spell checking." - :prefix "cape-jinx" - :group 'cape-jinx) + :prefix "cape-jinx-completion" + :group 'cape-jinx-completion) -(defcustom cape-jinx-case-replace 'case-replace +(defcustom cape-jinx-completion-case-replace 'case-replace "Preserve case of input. - See `dabbrev-case-replace' for details." +See `dabbrev-case-replace' for details." :type '(choice (const :tag "off" nil) (const :tag "use `case-replace'" case-replace) (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. - See `dabbrev-case-fold-search' for details." +See `dabbrev-case-fold-search' for details." :type '(choice (const :tag "off" nil) (const :tag "use `case-fold-search'" case-fold-search) (other :tag "on" t))) -(defvar cape--jinx-properties +(defvar cape-jinx-completion--properties (list :annotation-function (lambda (_) " Jinx") :company-kind (lambda (_) 'text) :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." (unless (equal input "") (cape--case-replace-list - cape-jinx-case-replace input - (jinx-suggest-for-word input)))) + cape-jinx-completion-case-replace input + (cape-jinx-completion-suggest-for-word input)))) ;;;###autoload -(defun cape-jinx (&optional interactive) +(defun cape-jinx-completion (&optional interactive) "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)) (if interactive - (cape-interactive #'cape-jinx) + (cape-interactive #'cape-jinx-completion) (pcase-let ((`(,beg . ,end) (cape--bounds 'word))) `(,beg ,end ,(cape--table-with-properties (completion-table-case-fold - (cape--cached-table beg end #'cape--jinx-list #'string-search) - (not (cape--case-fold-p cape-jinx-case-fold))) - :category 'cape-jinx) + (cape--cached-table beg end #'cape-jinx-completion--list #'string-search) + (not (cape--case-fold-p cape-jinx-completion-case-fold))) + :category 'cape-jinx-completion) ,@cape--jinx-properties)))) ;;; cape-jinx-completion.el ends here