manateelazycat / sdcv

Emacs interface for sdcv (Stardict console version)
73 stars 14 forks source link

sdcv failed to work on Ubuntu 20.04. #21

Closed hongyi-zhao closed 3 years ago

hongyi-zhao commented 3 years ago

On Ubuntu 20.04, I installed the latest sdcv and added some dictionaries as shown below:

werner@X10DAi:~$ sdcv -v
Console version of Stardict, version 0.5.3
werner@X10DAi:~$ sdcv -l
Dictionary's name   Word count
懒虫简明英汉词典    452185
Webster's Third New International Dictionary, Unabridged (En-En)    296190

The Emacs configuration for sdcv is as follows:

(use-package sdcv
  :demand t
  :straight (:host github :repo "manateelazycat/sdcv")
  :config
  ;https://github.com/manateelazycat/sdcv#configuration
  (setq ;sdcv-say-word-p t        ;say word after translation
        sdcv-dictionary-data-dir "~/.stardict/dic" ;setup directory of stardict dictionary
        sdcv-dictionary-simple-list    ;setup dictionary list for simple search
        '("Webster's Third New International Dictionary, Unabridged (En-En)"
          "懒虫简明英汉词典"
          )

        sdcv-dictionary-complete-list ;setup dictionary list for complete search
        '("Webster's Third New International Dictionary, Unabridged (En-En)"
          "懒虫简明英汉词典"
        )))

With the point on a word, say, "you", I issue the command `M-x sdcv-search-point RET', but nothing returned:

image

Any hints for this problem?

Regards, HY

ghost commented 3 years ago

Try M-x sdcv-check, the dictionary name might be wrong.

hongyi-zhao commented 3 years ago

Try M-x sdcv-check, the dictionary name might be wrong.

The dictionary’s settings look correct, sdcv should work as expected.

And emacs-sdcv works smoothly using the same dictionaries setting with the following configuration:

(use-package sdcv-mode
  :demand t
  :straight (:host github :repo "gucong/emacs-sdcv")
  :config
  (setq sdcv-dictionary-list 
        '("Webster's Third New International Dictionary, Unabridged (En-En)"
          "懒虫简明英汉词典")))

image

But emacs-sdcv can only return the query results from the first dictionary. I still can't figure out the fix.

manateelazycat commented 3 years ago

Please use sdcv-check, and read message of sdcv-check.

hongyi-zhao commented 3 years ago

image

image

ghost commented 3 years ago

@hongyi-zhao This is wired... But I believe that sdcv.el need a explicite require to work, dose the :ensure keyword provided by use-package guarantee this ? If not, try replace the :ensure t statement with :init (require 'sdcv)

hongyi-zhao commented 3 years ago

No, all the above tricks can't fix the problem. But sdcv.el works smoothly with the following configuration:

;https://github.com/stardiviner/sdcv.el
(use-package showtip)
(use-package sdcv
  :demand t
  :straight (stardiviner-sdcv\.el :local-repo "stardiviner-sdcv.el" :host github :repo "stardiviner/sdcv.el")
  :config
  (setq ; This version doesn't have the following options:
        ;sdcv-say-word-p t        ;say word after translation
        ;sdcv-dictionary-data-dir "~/.stardict/dic" ;setup directory of stardict dictionary

        ; Below are the valid options:
        ; sdcv-dictionary-simple-list    ;setup dictionary list for simple search
        ; '("Webster's Third New International Dictionary, Unabridged (En-En)"
        ;   "懒虫简明英汉词典")

        ;The query results are returned in the reverse order of the dictionaries that appear in the list.
        sdcv-dictionary-complete-list ;setup dictionary list for complete search
        (nreverse '("Webster's Third New International Dictionary, Unabridged (En-En)"
                    "Oxford English Dictionary 2nd Ed. P1"
                    "Oxford English Dictionary 2nd Ed. P2")))
  :bind
  ("C-x s" . sdcv-search-pointer))
Mercurius-Lee commented 3 years ago

No, all the above tricks can't fix the problem. But sdcv.el works smoothly with the following configuration:

;https://github.com/stardiviner/sdcv.el
(use-package showtip)
(use-package sdcv
  :demand t
  :straight (stardiviner-sdcv\.el :local-repo "stardiviner-sdcv.el" :host github :repo "stardiviner/sdcv.el")
  :config
  (setq ; This version doesn't have the following options:
        ;sdcv-say-word-p t        ;say word after translation
        ;sdcv-dictionary-data-dir "~/.stardict/dic" ;setup directory of stardict dictionary

        ; Below are the valid options:
        ; sdcv-dictionary-simple-list    ;setup dictionary list for simple search
        ; '("Webster's Third New International Dictionary, Unabridged (En-En)"
        ;   "懒虫简明英汉词典")

        ;The query results are returned in the reverse order of the dictionaries that appear in the list.
        sdcv-dictionary-complete-list ;setup dictionary list for complete search
        (nreverse '("Webster's Third New International Dictionary, Unabridged (En-En)"
                    "Oxford English Dictionary 2nd Ed. P1"
                    "Oxford English Dictionary 2nd Ed. P2")))
  :bind
  ("C-x s" . sdcv-search-pointer))

I also guessed that the " sdcv-check " function had a bug , since I used the stardiviner repo without the sdcv-check and it looks well.

X-Shine commented 3 years ago

@hongyi-zhao hello! I met the same problem today and my config is simliar to yours. Then I replace ~ to my absolute home path and it works. Do you replace ~ with your absolute home path? Sorry for my poor english.

hongyi-zhao commented 3 years ago

You're right. The following configuration works:

sdcv-dictionary-data-dir (expand-file-name "~/.stardict/dic")