Files
zedhugh b5d9ce18a7 use "creature/pkg-active" manage packages manually
- replace "add-pkg-in-pkg-dir" (recursive load-path scanning) with a
  central "creature/pkgs" registry that handles load path, autoloads,
  info dirs and dependencies
- adapt all init-*.el files to the new activation function
- add a top-level Makefile to byte-compile site-lisp packages
- remove unused "emacs-kv" and "emacs-db" submodules
2026-09-14 15:02:43 +08:00

43 lines
1.2 KiB
EmacsLisp

;; -*- coding: utf-8; lexical-binding: t; -*-
(require 'init-package)
(creature/pkg-active 'sdcv)
(creature/pkg-active '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))
(let ((word (word-at-point t)))
(when (and (not word) (eq major-mode 'sdcv-mode))
(setq word sdcv-current-translate-object))
word))))
(lazy-load-local-keys
'(("s" . sdcv-search-pointer)
("p" . sdcv-say-word-dwim))
creature/map "sdcv")
(with-eval-after-load 'sdcv
(setq sdcv-dictionary-data-dir (file-truename "~/.stardict/dic/"))
(setq sdcv-dictionary-simple-list
'("牛津英汉双解美化版"
"朗道英汉字典5.0"
"朗道汉英字典5.0"))
(setq sdcv-dictionary-complete-list
'("牛津英汉双解美化版"
"朗道英汉字典5.0"
"朗道汉英字典5.0"))
(lazy-load-set-keys
'(("P" . sdcv-say-word-dwim))
sdcv-mode-map))
(provide 'init-sdcv)