help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I build a dictionary in my Emacs?


From: Pascal J. Bourguignon
Subject: Re: Can I build a dictionary in my Emacs?
Date: Thu, 26 Nov 2009 12:00:30 +0100
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin)

Water Lin <WaterLin@ymail.invalid> writes:

> I want to build a dictionary in my Emacs. So I can put my specific
> words, expressions and their meanings into it.
>
> By doing this, when I need them, I don't need to google them out again.
>
> I don't know if it is suitable to call it dictionary, but it likes
> dictionary.
>
> Any good suggestions?

Perhaps you could use EBD, the Emacs Data Base?


But if you have a persistent internet connection, why don't you just
use M-x dictionary RET?


Also, using google shouldn't be a big deal from emacs:


(require 'cl)
(require 'w3m)

(setf browse-url-browser-function
    (lambda (url &rest args)
      (other-frame 1) ; or (make-frame)
      (w3m-goto-url url)))


(defun google-search (search-string)
  "Search a string with Google."
  (interactive "sGoogle Search: ")
  (setf search-string
        (shell-command-to-string
         (format "echo %s|iconv -f ISO8859-1 -t UTF-8"
           (shell-quote-argument search-string))))
  (browse-url
   (format 
"http://www.google.com/search?as_q=%s&num=50&hl=en&ie=ISO8869-1&btnG=Google+Search&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all&as_nlo=&as_nhi=&as_occt=any&as_dt=i&as_sitesearch=&safe=images";
     (apply (function concatenate) 'string
            (mapcar (lambda (ch)
                      (if (or (and (<= ?0 ch) (<= ch ?9))
                              (and (<= ?A ch) (<= ch ?Z))
                              (and (<= ?a ch) (<= ch ?z)))
                          (format "%c" ch)
                          (format "%%%02x" ch)))
                    (string-to-sequence search-string 'list)))))) 


(defun google-search-region (start end)
  "Search the text in the region with Google."
  (interactive "r")
  (google-search (buffer-substring-no-properties start end)))




-- 
__Pascal Bourguignon__


reply via email to

[Prev in Thread] Current Thread [Next in Thread]