add pronounce function for sdcv

This commit is contained in:
zedhugh committed 2025-01-02 08:47:43 +08:00
1 parent d4bbd17c82
commit ffbc750174
1 file changed
+16 -3
+16 -3
View File
@@ -6,10 +6,20 @@
(require 'lazy-load)
(require 'init-keybindings)
(autoload 'sdcv-say-word "sdcv" "")
(defun sdcv-say-word-dwim ()
"If region active, say the region text, otherwise say the word at point."
(interactive)
(sdcv-say-word
(if (region-active-p)
(buffer-substring-no-properties (region-beginning) (region-end))
(word-at-point t))))
(lazy-load-local-keys
'(("s" . sdcv-search-pointer))
'(("s" . sdcv-search-pointer)
("p" . sdcv-say-word-dwim))
creature/map "sdcv")
(with-eval-after-load 'sdcv
@@ -21,7 +31,10 @@
(setq sdcv-dictionary-complete-list
'("牛津英汉双解美化版"
"朗道英汉字典5.0"
"朗道汉英字典5.0")))
"朗道汉英字典5.0"))
(lazy-load-set-keys
'(("P" . sdcv-say-word-dwim))
sdcv-mode-map))
(provide 'init-sdcv)