mirror of
https://github.com/SqrtMinusOne/reverso.el.git
synced 2025-12-10 15:53:02 +03:00
docs: some docstring fixes
This commit is contained in:
parent
7ada161b22
commit
3f3ba9600b
1 changed files with 15 additions and 15 deletions
30
reverso.el
30
reverso.el
|
|
@ -1,4 +1,4 @@
|
||||||
;;; reverso.el --- Translation, grammar checking and bilingual concordances -*- lexical-binding: t -*-
|
;;; reverso.el --- Translation, grammar checking, context search -*- lexical-binding: t -*-
|
||||||
|
|
||||||
;; Copyright (C) 2022 Korytov Pavel
|
;; Copyright (C) 2022 Korytov Pavel
|
||||||
|
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
(declare-function evil-define-key* "evil-core")
|
(declare-function evil-define-key* "evil-core")
|
||||||
|
|
||||||
(defgroup reverso nil
|
(defgroup reverso nil
|
||||||
"Translation, grammar checking and bilingual concordances."
|
"Translation, grammar checking, context search."
|
||||||
:group 'applications)
|
:group 'applications)
|
||||||
|
|
||||||
(defface reverso-highlight-face
|
(defface reverso-highlight-face
|
||||||
|
|
@ -318,7 +318,7 @@ The result is an alist with the following keys:
|
||||||
(defun reverso--convert-string (dom)
|
(defun reverso--convert-string (dom)
|
||||||
"Convert DOM from the reverso API to fontified string.
|
"Convert DOM from the reverso API to fontified string.
|
||||||
|
|
||||||
reverso.net uses tags to highlight relevant works, e.g. <em> for the
|
reverso.net uses tags to highlight relevant words, e.g. <em> for the
|
||||||
selected word in the context search. This function fontifies words
|
selected word in the context search. This function fontifies words
|
||||||
that are in tags with `reverso-highlight-face'"
|
that are in tags with `reverso-highlight-face'"
|
||||||
(thread-last
|
(thread-last
|
||||||
|
|
@ -337,7 +337,7 @@ that are in tags with `reverso-highlight-face'"
|
||||||
(rx (+ (syntax whitespace))) " ")))
|
(rx (+ (syntax whitespace))) " ")))
|
||||||
|
|
||||||
(defun reverso--convert-string-html (html)
|
(defun reverso--convert-string-html (html)
|
||||||
"Convert HTML string from the reverso API to fontified string."
|
"Convert an HTML string from the reverso API to fontified string."
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert "<html><body>" html "<body></html>")
|
(insert "<html><body>" html "<body></html>")
|
||||||
(reverso--convert-string
|
(reverso--convert-string
|
||||||
|
|
@ -459,7 +459,7 @@ The result is a list of alists with the following keys:
|
||||||
- `:synonym': word
|
- `:synonym': word
|
||||||
- `:relevant': if t, considered a \"good match\" by the service
|
- `:relevant': if t, considered a \"good match\" by the service
|
||||||
- `:examples': list of strings with examples
|
- `:examples': list of strings with examples
|
||||||
- `:antonyms': list of alists
|
- `:antonyms': list of alists:
|
||||||
- `:antonym': word"
|
- `:antonym': word"
|
||||||
(unless (alist-get language reverso--language-mapping-1)
|
(unless (alist-get language reverso--language-mapping-1)
|
||||||
(error "Wrong language: %s" language))
|
(error "Wrong language: %s" language))
|
||||||
|
|
@ -525,7 +525,7 @@ HTML is a string."
|
||||||
|
|
||||||
CB is called with the result.
|
CB is called with the result.
|
||||||
|
|
||||||
The result is an alist with the keys:
|
The result is an alist with the following keys:
|
||||||
`:corrected-text': corrected version of TEXT
|
`:corrected-text': corrected version of TEXT
|
||||||
`:source-text-hl': TEXT with highlighted errors
|
`:source-text-hl': TEXT with highlighted errors
|
||||||
`:corrections': a list of alists with keys:
|
`:corrections': a list of alists with keys:
|
||||||
|
|
@ -806,7 +806,7 @@ DATA is an alist as defined in `reverso--get-grammar'."
|
||||||
(reverso--grammar-render-error corr))))
|
(reverso--grammar-render-error corr))))
|
||||||
|
|
||||||
(defun reverso--grammar-render-error (corr)
|
(defun reverso--grammar-render-error (corr)
|
||||||
"Render one error of grammar checking results.
|
"Render one error from grammar checking results.
|
||||||
|
|
||||||
CORR is one element of the `:corrections' list, as defined in
|
CORR is one element of the `:corrections' list, as defined in
|
||||||
`reverso--get-grammar'."
|
`reverso--get-grammar'."
|
||||||
|
|
@ -854,7 +854,7 @@ CORR is one element of the `:corrections' list, as defined in
|
||||||
(insert "\n")))
|
(insert "\n")))
|
||||||
|
|
||||||
(defmacro reverso--with-buffer (&rest body)
|
(defmacro reverso--with-buffer (&rest body)
|
||||||
"Execute BODY in the clean `reverso' results buffer."
|
"Execute BODY in a clean `reverso' results buffer."
|
||||||
(declare (indent 0))
|
(declare (indent 0))
|
||||||
`(progn
|
`(progn
|
||||||
(let ((buffer (get-buffer-create
|
(let ((buffer (get-buffer-create
|
||||||
|
|
@ -872,7 +872,7 @@ CORR is one element of the `:corrections' list, as defined in
|
||||||
(defun reverso-check-clear (&optional region-start region-end)
|
(defun reverso-check-clear (&optional region-start region-end)
|
||||||
"Remove reverso grammar check overlays.
|
"Remove reverso grammar check overlays.
|
||||||
|
|
||||||
If run when a region is active, remove overlays only in that region.
|
If a region is active, remove overlays only in that region.
|
||||||
|
|
||||||
REGION-START and REGION-END are borders of the region."
|
REGION-START and REGION-END are borders of the region."
|
||||||
(interactive (if (use-region-p)
|
(interactive (if (use-region-p)
|
||||||
|
|
@ -968,7 +968,7 @@ alist as defined in `reverso--get-grammar'."
|
||||||
(user-error "No errors left!"))))))
|
(user-error "No errors left!"))))))
|
||||||
|
|
||||||
(defun reverso--get-error-at-point ()
|
(defun reverso--get-error-at-point ()
|
||||||
"Return overlay reverso error at point."
|
"Return reverso error at point."
|
||||||
(cl-loop for ov in (overlays-at (point))
|
(cl-loop for ov in (overlays-at (point))
|
||||||
if (overlay-get ov 'reverso-correction)
|
if (overlay-get ov 'reverso-correction)
|
||||||
return (cons ov (overlay-get ov 'reverso-correction))))
|
return (cons ov (overlay-get ov 'reverso-correction))))
|
||||||
|
|
@ -984,7 +984,7 @@ alist as defined in `reverso--get-grammar'."
|
||||||
(reverso-check-next-error))))
|
(reverso-check-next-error))))
|
||||||
|
|
||||||
(defun reverso-describe-error-at-point ()
|
(defun reverso-describe-error-at-point ()
|
||||||
"Describe reverso-error at point."
|
"Describe reverso error at point."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((err (reverso--get-error-at-point)))
|
(let ((err (reverso--get-error-at-point)))
|
||||||
(unless err
|
(unless err
|
||||||
|
|
@ -1143,9 +1143,9 @@ slots:
|
||||||
the value is a list of available target languages for that source
|
the value is a list of available target languages for that source
|
||||||
language.
|
language.
|
||||||
|
|
||||||
If `is-target' is non-nil, then selection of languages has to limited.
|
If `is-target' is non-nil, then selection of languages has to be
|
||||||
In that case, `reverso--source-value' is used to get the source
|
limited. In that case, `reverso--source-value' is used to get the
|
||||||
language."
|
source language."
|
||||||
(let* ((all-languages
|
(let* ((all-languages
|
||||||
(seq-sort
|
(seq-sort
|
||||||
(lambda (a b) (string-lessp (symbol-name a)
|
(lambda (a b) (string-lessp (symbol-name a)
|
||||||
|
|
@ -1180,7 +1180,7 @@ called `is-target'."
|
||||||
'reverso--source-value))
|
'reverso--source-value))
|
||||||
|
|
||||||
(cl-defmethod transient-init-value ((obj reverso--transient-language))
|
(cl-defmethod transient-init-value ((obj reverso--transient-language))
|
||||||
"Initialize the value for the language picker.
|
"Initialize the value of the language picker.
|
||||||
|
|
||||||
OBJ is an instance of `reverso--transient-language'."
|
OBJ is an instance of `reverso--transient-language'."
|
||||||
(let ((value
|
(let ((value
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue