mirror of
https://github.com/SqrtMinusOne/reverso.el.git
synced 2025-12-10 15:53:02 +03:00
Add function parameters to the operation hook
This commit is contained in:
parent
6348fae8f6
commit
5ae2091124
1 changed files with 19 additions and 6 deletions
25
reverso.el
25
reverso.el
|
|
@ -284,8 +284,11 @@ The operations are:
|
||||||
- `reverso--get-synonyms'
|
- `reverso--get-synonyms'
|
||||||
- `reverso--get-grammar'
|
- `reverso--get-grammar'
|
||||||
|
|
||||||
The hook is called with two arguments: the operation name (the
|
The hook is called with the following arguments:
|
||||||
function symbol) and the result of the operation.")
|
- the operation name
|
||||||
|
- the result of the operation, that is the value passed to the
|
||||||
|
callback
|
||||||
|
- parameters of the operation")
|
||||||
|
|
||||||
(defun reverso--translate (text source target cb)
|
(defun reverso--translate (text source target cb)
|
||||||
"Translate TEXT from language SOURCE to TARGET.
|
"Translate TEXT from language SOURCE to TARGET.
|
||||||
|
|
@ -340,7 +343,10 @@ The result is an alist with the following keys:
|
||||||
(reverso--translate-parse data))))
|
(reverso--translate-parse data))))
|
||||||
(run-hook-with-args
|
(run-hook-with-args
|
||||||
'reverso--operation-hook
|
'reverso--operation-hook
|
||||||
'reverso--translate res)
|
'reverso--translate res
|
||||||
|
`((:text . ,text)
|
||||||
|
(:source . ,source)
|
||||||
|
(:target . ,target)))
|
||||||
(funcall cb res))))
|
(funcall cb res))))
|
||||||
:error (cl-function
|
:error (cl-function
|
||||||
(lambda (&key error-thrown &allow-other-keys)
|
(lambda (&key error-thrown &allow-other-keys)
|
||||||
|
|
@ -461,7 +467,10 @@ The result is a list of alists with the keys:
|
||||||
(reverso--get-context-parse data))))
|
(reverso--get-context-parse data))))
|
||||||
(run-hook-with-args
|
(run-hook-with-args
|
||||||
'reverso--operation-hook
|
'reverso--operation-hook
|
||||||
'reverso--get-context res)
|
'reverso--get-context res
|
||||||
|
`((:text . ,text)
|
||||||
|
(:source . ,source)
|
||||||
|
(:target . ,target)))
|
||||||
(funcall cb res))))
|
(funcall cb res))))
|
||||||
:error (cl-function
|
:error (cl-function
|
||||||
(lambda (&key error-thrown &allow-other-keys)
|
(lambda (&key error-thrown &allow-other-keys)
|
||||||
|
|
@ -513,7 +522,9 @@ The result is a list of alists with the following keys:
|
||||||
(reverso--get-synonyms-parse data))))
|
(reverso--get-synonyms-parse data))))
|
||||||
(run-hook-with-args
|
(run-hook-with-args
|
||||||
'reverso--operation-hook
|
'reverso--operation-hook
|
||||||
'reverso--get-synonyms res)
|
'reverso--get-synonyms res
|
||||||
|
`((:text . ,text)
|
||||||
|
(:language . ,language)))
|
||||||
(funcall cb res))))
|
(funcall cb res))))
|
||||||
:error (cl-function
|
:error (cl-function
|
||||||
(lambda (&key error-thrown &allow-other-keys)
|
(lambda (&key error-thrown &allow-other-keys)
|
||||||
|
|
@ -612,7 +623,9 @@ The result is an alist with the following keys:
|
||||||
(reverso--get-grammar-parse text data))))
|
(reverso--get-grammar-parse text data))))
|
||||||
(run-hook-with-args
|
(run-hook-with-args
|
||||||
'reverso--operation-hook
|
'reverso--operation-hook
|
||||||
'reverso--get-grammar res)
|
'reverso--get-grammar res
|
||||||
|
`((:text . ,text)
|
||||||
|
(:language . ,language)))
|
||||||
(funcall cb res))))
|
(funcall cb res))))
|
||||||
:error (cl-function
|
:error (cl-function
|
||||||
(lambda (&key error-thrown &allow-other-keys)
|
(lambda (&key error-thrown &allow-other-keys)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue