unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* stardict and emacs
@ 2010-12-12  8:57 François Patte
  2010-12-12 10:23 ` B.Qnyd
  0 siblings, 1 reply; 3+ messages in thread
From: François Patte @ 2010-12-12  8:57 UTC (permalink / raw)
  To: help-gnu-emacs

Bonjour,

I would like to use stardict in an emacs window, but I fail... I found a
stardict.el and a sdcv.el, and loaded them, but I don't know what to do
(I have added some lines in my .emacs, but I don't know how to make a
correct adaptation to my system).

I run linux with emacs 23

stardict is installed in /usr/bin/

dictionaries are in /usr/share/stardict/dic/


What I would like is to be able to choose a dictionary, and ask for a
word through emacs (in minibuff) and have the answer displayed in a new
buffer/window.

Is this possible and how?

Thank you
-- 
François Patte
Université Paris Descartes


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: stardict and emacs
  2010-12-12  8:57 stardict and emacs François Patte
@ 2010-12-12 10:23 ` B.Qnyd
  2010-12-13 21:57   ` François Patte
  0 siblings, 1 reply; 3+ messages in thread
From: B.Qnyd @ 2010-12-12 10:23 UTC (permalink / raw)
  To: help-gnu-emacs

On Dec 12, 4:57 pm, François Patte
<francois.pa...@mi.parisdescartes.fr> wrote:
> Bonjour,
>
> I would like to use stardict in an emacs window, but I fail... I found a
> stardict.el and a sdcv.el, and loaded them, but I don't know what to do
> (I have added some lines in my .emacs, but I don't know how to make a
> correct adaptation to my system).
>
> I run linux with emacs 23
>
> stardict is installed in /usr/bin/
>
> dictionaries are in /usr/share/stardict/dic/
>
> What I would like is to be able to choose a dictionary, and ask for a
> word through emacs (in minibuff) and have the answer displayed in a new
> buffer/window.
>
> Is this possible and how?
>
> Thank you
> --
> Fran ois Patte
> Universit Paris Descartes

i am used it...

it's good!
-----------------------------------------
you used it, need install  Stardict of Character Version..

my install it's sdcv-0.4.2-1mdv2008.0.i586.rpm

in .emacs add:

(require 'sdcv)

;; 调用 stardict 的命令行程序 sdcv 来查辞典
;; 如果选中了 region 就查询 region 的内容,否则查询当前光标所在的单词
;; 查询结果在一个叫做 *sdcv* 的 buffer 里面显示出来,在这个 buffer 里面
;; 按 q 可以把这个 buffer 放到 buffer 列表末尾,按 d 可以查询单词
(global-set-key (kbd "C-c d") 'kid-sdcv-to-buffer)
(defun kid-sdcv-to-buffer ()
  (interactive)
  (let ((word (if mark-active
                  (buffer-substring-no-properties (region-beginning)
(region-end))
                  (current-word nil t))))
    (setq word (read-string (format "Search the dictionary for
(default %s): " word)
                            nil nil word))
    (set-buffer (get-buffer-create "*sdcv*"))
    (buffer-disable-undo)
    (erase-buffer)
    (let ((process (start-process-shell-command "sdcv" "*sdcv*" "sdcv"
"-n" word)))
      (set-process-sentinel
       process
       (lambda (process signal)
         (when (memq (process-status process) '(exit signal))
           (unless (string= (buffer-name) "*sdcv*")
             (setq kid-sdcv-window-configuration (current-window-
configuration))
             (switch-to-buffer-other-window "*sdcv*")
             (local-set-key (kbd "d") 'kid-sdcv-to-buffer)
             (local-set-key (kbd "q") (lambda ()
                                        (interactive)
                                        (bury-buffer)
                                        (unless (null (cdr (window-
list))) ; only one window
                                          (delete-window)))))
           (goto-char (point-min))))))))


select word used C-c d  ..now used it;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: stardict and emacs
  2010-12-12 10:23 ` B.Qnyd
@ 2010-12-13 21:57   ` François Patte
  0 siblings, 0 replies; 3+ messages in thread
From: François Patte @ 2010-12-13 21:57 UTC (permalink / raw)
  To: help-gnu-emacs

Le 12/12/2010 11:23, B.Qnyd a écrit :
> On Dec 12, 4:57 pm, François Patte
> <francois.pa...@mi.parisdescartes.fr> wrote:
>> Bonjour,
>>
>> I would like to use stardict in an emacs window, but I fail... I found a
>> stardict.el and a sdcv.el, and loaded them, but I don't know what to do
>> (I have added some lines in my .emacs, but I don't know how to make a
>> correct adaptation to my system).

> 
> i am used it...
> 
> it's good!
> -----------------------------------------
> you used it, need install  Stardict of Character Version..
> 
> my install it's sdcv-0.4.2-1mdv2008.0.i586.rpm

OK Thanks. I installed it and it works but:

1- It opens a stardict window for the display of answer. Is it not
possible to have a display in an emacs window.

2- You have to choose the proper dictionary *after* the openning of
stardict window, not before: e.g I have a French word in my emacs buffer
and I want to know its translation into English, can I choose the
French-English dictionary (now, the selected dictionary group is the
last one I used...)

3- Worst: everytime I ask stardict through emacs, it opens a new
instance of stardict and does not use the instance running in background...

Are there any solutions to these problems?

Thanks.

-- 
François Patte
Université Paris Descartes


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-13 21:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-12  8:57 stardict and emacs François Patte
2010-12-12 10:23 ` B.Qnyd
2010-12-13 21:57   ` François Patte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).