1 ;;; tyda.el --- Lookup words in swe/eng dictionary at tyda.se
3 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
4 ;; Created: 2008-08-26T02:51:27+0200 Tue
11 ;; Features that might be required by this library:
15 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19 ;; Lookup swedish or english words in the dictionary at
21 ;; http://www.tyda.se/
23 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
30 ;; This program is free software; you can redistribute it and/or
31 ;; modify it under the terms of the GNU General Public License as
32 ;; published by the Free Software Foundation; either version 2, or
33 ;; (at your option) any later version.
35 ;; This program is distributed in the hope that it will be useful,
36 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
37 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
38 ;; General Public License for more details.
40 ;; You should have received a copy of the GNU General Public License
41 ;; along with this program; see the file COPYING. If not, write to
42 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
43 ;; Floor, Boston, MA 02110-1301, USA.
45 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
49 (eval-when-compile (require 'appmenu))
51 (defun tyda-lookup-word (word)
52 "Look up word WORD at URL `http://tyda.se/'.
53 This site translates between English and Swedish. The site will
54 be opened in your webbrowser with WORD looked up."
55 (interactive (list (or (thing-at-point 'word)
56 (read-string "Lookup word: "))))
57 ;; http://tyda.se/search?form=1&w=weird&w_lang=&x=0&y=0
59 ;;(concat "http://www.tyda.se/?rid=651940&w=" word)
60 (format "http://tyda.se/search?form=1&w=%s&w_lang=&x=0&y=0" word)
63 (defvar tyda-appmenu-map
64 (let ((map (make-sparse-keymap)))
65 (define-key map [tyda-lookup]
66 (list 'menu-item "Lookup word at point in Tyda"
71 (let ((map (make-sparse-keymap)))
72 (define-key map [(alt mouse-1)] 'tyda-lookup-word)
73 (define-key map [(control ?c) ?=] 'tyda-lookup-word)
77 (define-minor-mode tyda-mode
78 "Minor mode for key bindings for `tyda-lookup-word'.
79 It binds Alt-Mouse-1 just as the Tyda add-on does in Firefox.
80 Here are all key bindings
87 (require 'appmenu nil t)
88 (when (featurep 'appmenu)
89 (appmenu-add 'tyda nil tyda-mode "Lookup word" tyda-appmenu-map)))))
93 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;