youdao-dictionary
是 Emacs 的一個簡單的有道字典(有道字典)介面。
從 MELPA 安裝youdao-dictionary
:
Mx package-install RET youdao-dictionary RET
有道於今年稍早(2023 年)停止提供免費 API,因此該軟體包不再可以開箱即用。您需要自行申請API。
您可以在~/.authinfo.gpg
或~/.authinfo
中設定您的 api 金鑰和秘密,例如,
機器 openapi.youdao.com 登入 應用程式ID 密碼 應用程式秘鑰
或者,您可以在配置中設定它們,例如,
; ; Change 应用ID and 应用秘钥 to yours
( setq youdao-dictionary-app-key "应用ID "
youdao-dictionary-secret-key "应用秘钥" )
youdao-dictionary-search-at-point
youdao-dictionary-search-at-point+
youdao-dictionary-search-at-point-tooltip
youdao-dictionary-search-at-point-posframe
youdao-dictionary-search-from-input
youdao-dictionary-search-and-replace
youdao-dictionary-play-voice-at-point
youdao-dictionary-play-voice-from-input
youdao-dictionary-posframe-tip-face
tooltip
; ; Enable Cache
( setq url-automatic-caching t )
; ; Example Key binding
( global-set-key ( kbd " C-c y " ) 'youdao-dictionary-search-at-point )
; ; Integrate with popwin-el (https://github.com/m2ym/popwin-el)
; ; (push "*Youdao Dictionary*" popwin:special-display-config)
; ; Set file path for saving search history
; ; (setq youdao-dictionary-search-history-file "~/.emacs.d/.youdao")
; ; Enable Chinese word segmentation support (支持中文分词)
; ; (setq youdao-dictionary-use-chinese-word-segmentation t)
註:需要外部中文分詞工具(如結巴分詞)來啟用中文分詞支援。有關更多信息,請參閱 chinese-word-at-point.el#precession。