-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
建议增加一个本地词典查询 #29
Comments
kimim
added a commit
to kimim/kimim-emacs
that referenced
this issue
Jun 17, 2023
Hello, I combined the power of sdcv with fanyi.el: (require 'sdcv)
(defun kimim/sdcv-translate-result-advice (word dictionary-list)
(let* ((arguments
(cons word
(mapcan
(lambda (d) (list "-u" d)) dictionary-list)))
(result (mapconcat
(lambda (result)
(let-alist result
(format
"## %s\n%s\n\n" .dict .definition)))
(apply #'sdcv-call-process arguments)
"")))
(if (string-empty-p result)
sdcv-fail-notify-string
result)))
(advice-add 'sdcv-translate-result
:override
#'kimim/sdcv-translate-result-advice)
(defun kimim/fanyi-dwim-add-sdcv (word)
(let ((buf (get-buffer fanyi-buffer-name)))
(with-current-buffer buf
(let ((inhibit-read-only t)
(inhibit-point-motion-hooks t))
;; Clear the previous search result.
(point-max)
(insert "# SDCV\n\n")
(insert
(sdcv-search-with-dictionary
word sdcv-dictionary-complete-list))
(insert "\n\n")
(beginning-of-buffer)))))
(advice-add 'fanyi-dwim :after
#'kimim/fanyi-dwim-add-sdcv) |
我在 emacs-china 上看到你发的帖子了! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
为了加快查询速度(在线查结果总是要等一下才能出来)
建议结合https://github.com/skywind3000/ECDICT
增加一个本地简明英汉的查询结果,这样不仅速度快,断网的时候也能用
The text was updated successfully, but these errors were encountered: