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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

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

Stefan Reichör
;;; leo-dict.el --- emacs interface for http://dict.leo.org

;; Copyright (C) 2005 by Stefan Reichoer

;; Author: Stefan Reichoer, <[hidden email]>

;; 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
;; 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))
  (insert "------------------------------------------------------------------")
  (insert (concat "Lookup " word ":"))
  (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))

(defun leo-run-query-with-word-at-point ()
  (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
Gnu-emacs-sources mailing list
[hidden email]