Make checkdoc happier + typo fixing

This commit is contained in:
TEC 2021-01-25 17:38:26 +08:00
parent f43e36d413
commit 9281660c30
Signed by: tec
GPG Key ID: 779591AFDB81F06C
1 changed files with 19 additions and 15 deletions

View File

@ -66,7 +66,7 @@
;; new face vars in the future
;; * Change the default of `lexic-program-path' to be an absolute path
;; * New functions: `lexic-format-result', `lexic-failed-p',
;; and `lexic-format-failure' to handle the upgraded entry prodessing
;; and `lexic-format-failure' to handle the upgraded entry processing
;; * New functions: `lexic-format-webster', `lexic-format-online-etym',
;; `lexic-format-element', and `lexic-format-soule' to format
;; the dictionaries recognised by default in `lexic-dictionary-specs'.
@ -161,7 +161,7 @@ which will cause all avalible dictionaries to be used.")
"A list of prompts that lexic use to prompt for word.")
(defvar lexic-choice-prompts '("Your choice[-1 to abort]: ")
"A list of prompts that lexic use to prompt for a choice of multiple candicates.")
"A list of prompts that lexic use to prompt for a choice of multiple candidates.")
(defvar lexic-result-patterns '("^Found [0-9]+ items, similar to [*?/|]*\\(.+?\\)[*?]*\\.")
"A list of patterns to extract result word of lexic.
@ -374,7 +374,11 @@ Using `lexic-current-dictionary-list' and `lexic-dictionary-path'."
(define-derived-mode lexic-mode text-mode "lexic"
"Major mode to look up word through lexic.
\\{lexic-mode-map}
Turning on Text mode runs the normal hook `lexic-mode-hook'."
Turning on lexic mode runs the normal hook `lexic-mode-hook'.
This mode locally removes any `spell-fu-mode' or `flyspell-mode' entries in
`text-mode-hook', but won't catch any other spell-checking initialisation.
Consider resolving any edge cases with an addition to `lexic-mode-hook'."
(setq-local text-mode-hook
(remove #'spell-fu-mode
(remove #'flyspell-mode
@ -567,9 +571,9 @@ Remove it and return t if found. Return nil otherwise."
;;;;##################################################################
(defun lexic-format-result (result)
"For a given RESULT from lexic, test for failure and format accordingly.
Entries are sorted by their :priority in `lexic-dictionary-specs', then formatted
by `lexic-format-result' in successful lexic, `cases-format-failure' otherwise."
"For a RESULT from lexic, test for failure and format accordingly.
Entries are sorted by their :priority in `lexic-dictionary-specs' then formatted
by `lexic-format-result' in successful case, `cases-format-failure' otherwise."
(if (lexic-failed-p result)
(lexic-format-failure result)
@ -659,11 +663,11 @@ Returns a list of plists with keys :word, :dict, and :info."
(or (lexic-dictionary-spec (car b) :priority) 1))))
"\n"))))
(defun lexic-format-entry (entry &optional _expected-word)
(defun lexic-format-entry (entry &optional expected-word)
"Format a given ENTRY, a plist with :word :dict and :info.
If the DICT has a :short value in `lexic-dictionary-specs' that is used as
the display name. Likewise if present, :formatter is used to generate the
entry."
entry. EXPECTED-WORD is the word expected in ENTRY."
(let ((dict (plist-get entry :dict)))
(concat
"\n\u200B\u200B"
@ -672,7 +676,7 @@ entry."
"\n\u2008\n"
(if-let* ((formatter (lexic-dictionary-spec dict :formatter)))
(let ((case-fold-search nil))
(string-trim (funcall formatter entry _expected-word)))
(string-trim (funcall formatter entry expected-word)))
(plist-get entry :info))
"\n")))
@ -746,7 +750,7 @@ a plist whith the following options:
"Helper function to get a :SPEC of a given DICT."
(plist-get (cdr (assoc dict lexic-dictionary-specs)) spec))
(defun lexic-format-webster (entry &optional _expected-word)
(defun lexic-format-webster (entry &optional expected-word)
"Make a Webster's dictionary ENTRY for WORD look nice.
Designed for Webster's Revised Unabridged Dictionary (1913),as found at
http://download.huzheng.org/dict.org/stardict-dictd-web1913-2.4.2.tar.bz2.
@ -776,7 +780,7 @@ This should also work nicely with GCIDE."
(+ (or (+ (not (any "][")))
(and "[" (+ (not (any "]["))) "]"))))
"]")
(optional ; definately etymology
(optional ; definitely etymology
(+ (any "\n" " ")) "["
(group-n 6
(+ (or (+ (not (any "][")))
@ -1733,7 +1737,7 @@ Can also set a MIN-WIDTH for new lines of text created by a line break,
an INITIAL-COLUNM that the text starts at, and an INDENT string to be inserted
after every line break.
When regex SEPREGEX is provided, it is used to detect word seperators.
When regex SEPREGEX is provided, it is used to detect word separators.
It is \"[ ,.]\" by default."
(let* ((initial-col (or initial-colunm 0))
(min-width (or min-width 1))
@ -1770,7 +1774,7 @@ It is \"[ ,.]\" by default."
text))))
reflowed-text))
(defun lexic-format-online-etym (entry &optional _expected-word)
(defun lexic-format-online-etym (entry &optional expected-word)
"Make an html ENTRY look nice.
Designed for an export of Douglas Harper's Online Etymology Dictionary,
collected using https://framagit.org/tuxor1337/dictmaster."
@ -1849,7 +1853,7 @@ collected using https://framagit.org/tuxor1337/dictmaster."
(lambda (match)
(lexic-format-reflow-text match 80 5)))))
(defun lexic-format-element (entry &optional _expected-word)
(defun lexic-format-element (entry &optional expected-word)
"Make an ENTRY for an element Look nice.
Based on http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_elements-2.4.2.tar.bz2."
(replace-regexp-in-string
@ -1874,7 +1878,7 @@ Atomic weight: \\((?[0-9.]+)?\\)"
(propertize element 'face 'font-lock-string-face))))
(plist-get entry :info)))
(defun lexic-format-soule (entry &optional _expected-word)
(defun lexic-format-soule (entry &optional expected-word)
"Format an ENTRY for WORD in Soule's Dictionary of English Synonyms.
Designed using http://download.huzheng.org/bigdict/stardict-Soule_s_Dictionary_of_English_Synonyms-2.4.2.tar.bz2."
(->> (plist-get entry :info)