fix(lookup): wordnik dict backend returning nothing

Ref abo-abo/define-word#31
This commit is contained in:
Henrik Lissner 2021-09-27 21:27:55 +02:00
parent 5a8af71b0b
commit cdb59b0a3d

View file

@ -215,6 +215,15 @@ Dictionary.app behind the scenes to get definitions.")
:unless IS-MAC :unless IS-MAC
:defer t :defer t
:config :config
;; REVIEW Temporarily fix abo-abo/define-word#31
(defadvice! +lookup--fix-define-word-a (fn &rest args)
"Fix `define-word' backends that require a user agent (like wordnik)."
:around #'define-word
(let ((url-request-extra-headers
'(("User-Agent" .
"Mozilla/5.0 (Macintosh; Intel Mac OS X 11_5_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36"))))
(apply fn args)))
(setq define-word-displayfn-alist (setq define-word-displayfn-alist
(cl-loop for (service . _) in define-word-services (cl-loop for (service . _) in define-word-services
collect (cons service #'+eval-display-results-in-popup)))) collect (cons service #'+eval-display-results-in-popup))))