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

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

leo-dict.el --- emacs interface for http://dict.leo.org


From: Stefan Reichör
Subject: leo-dict.el --- emacs interface for http://dict.leo.org
Date: Fri, 12 Aug 2005 22:45:27 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

;;; leo-dict.el --- emacs interface for http://dict.leo.org

;; Copyright (C) 2005 by Stefan Reichoer

;; Author: Stefan Reichoer, <address@hidden>

;; leo-dict.el is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; leo-dict.el is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Commentary:

;; leo-dict.el provides an emacs interface for the german<->english
;; dictionary on http://dict.leo.org

;; The latest revision of leo-dict.el can be found at: 
http://www.xsteve.at/prg/emacs

;; leo-dict.el needs my python script 'leo' to interact with the web interface
;; leo can be found here: http://www.xsteve.at/prg/python

;;; History:
;;

;;; Code:

(defvar leo-use-pymacs nil)
(defvar leo-program-name "leo") ;; On windows: python c:/utils/python/leo.py
(defvar leo-temp-file-name "~/tmp/leo-result")

(defun leo-run-query (word)
  "Query dict.leo.org for a word.
This calls my python script leo (it can be found at: 
http://www.xsteve.at/prg/python)"
  (interactive "sLookup word at dict.leo.org: ")
  (pop-to-buffer "*LEO dictionary*")
  (goto-char (point-max))
  (newline)
  (insert "------------------------------------------------------------------")
  (newline)
  (insert (concat "Lookup " word ":"))
  (newline)
  (if leo-use-pymacs
      (insert (leo-py-search word))
    (shell-command-to-string (concat leo-program-name " " word " > " 
leo-temp-file-name))
    (insert-file leo-temp-file-name)
    (delete-file leo-temp-file-name))
  (end-of-buffer))


(defun leo-run-query-with-word-at-point ()
  (interactive)
  (let ((word (thing-at-point 'word)))
    (message "Querying dict.leo.org for %s" word)
    (xsteve-run-leo word)))


(provide 'leo-dict)

;;; leo-dict.el ends here

;;; arch-tag: daca3e4a-f131-45d2-9946-1f9c6a88fa97


reply via email to

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