unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "B.Qnyd" <bb.qnyd@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: stardict and emacs
Date: Sun, 12 Dec 2010 02:23:19 -0800 (PST)	[thread overview]
Message-ID: <78a4d641-0b6e-4875-b1fa-efd010d6da04@h17g2000pre.googlegroups.com> (raw)
In-Reply-To: ie22p1$8mq$1@speranza.aioe.org

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;


  reply	other threads:[~2010-12-12 10:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-12  8:57 stardict and emacs François Patte
2010-12-12 10:23 ` B.Qnyd [this message]
2010-12-13 21:57   ` François Patte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=78a4d641-0b6e-4875-b1fa-efd010d6da04@h17g2000pre.googlegroups.com \
    --to=bb.qnyd@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).