Fix references to old dictionary/thesaurus lookup commands

And pass word explicitly to powerthesaurus.
This commit is contained in:
Henrik Lissner 2020-01-02 20:03:50 -05:00
parent f313c77ac7
commit 6938f8b97d
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 10 additions and 3 deletions

View file

@ -353,4 +353,11 @@ Otherwise, falls back on `find-file-at-point'."
(unless +lookup-dictionary-enable-online
;; TODO Implement offline synonyms backend
(user-error "No offline dictionary implemented yet"))
(powerthesaurus-lookup-word-dwim))
;; Necessary because powerthesaurus lacks a way to pass text directly
(with-temp-buffer
(insert identifier)
;; HACK I'd rather use `+lookup-symbol-or-region' for consistency, but
;; powerthesaurus lacks a simple way to pass a string directly to any
;; of its lookup functions, so...
(cl-letf (((symbol-function 'use-region-p) (lambda () t)))
(powerthesaurus-lookup-word (point-min) (point-max)))))

View file

@ -193,5 +193,5 @@ See https://github.com/magit/ghub/issues/81"
(when (featurep! +dictionary)
(define-key! text-mode-map
[remap +lookup/definition] #'+lookup/word-definition
[remap +lookup/references] #'+lookup/word-synonyms))
[remap +lookup/definition] #'+lookup/dictionary-definition
[remap +lookup/references] #'+lookup/synonyms))