From 94d2fc1815a919734353c942f224db1de4b4fcb8 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Mon, 7 Mar 2011 09:04:49 +0100 Subject: Django, org * Added nxhtml, mostly for django support. * Changed some org settings. --- emacs.d/nxhtml/util/tyda.el | 94 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 emacs.d/nxhtml/util/tyda.el (limited to 'emacs.d/nxhtml/util/tyda.el') diff --git a/emacs.d/nxhtml/util/tyda.el b/emacs.d/nxhtml/util/tyda.el new file mode 100644 index 0000000..d4f3ea6 --- /dev/null +++ b/emacs.d/nxhtml/util/tyda.el @@ -0,0 +1,94 @@ +;;; tyda.el --- Lookup words in swe/eng dictionary at tyda.se +;; +;; Author: Lennart Borgman (lennart O borgman A gmail O com) +;; Created: 2008-08-26T02:51:27+0200 Tue +;; Version: 0.2 +;; Last-Updated: +;; URL: +;; Keywords: +;; Compatibility: +;; +;; Features that might be required by this library: +;; +;; None +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: +;; +;; Lookup swedish or english words in the dictionary at +;; +;; http://www.tyda.se/ +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Change log: +;; +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; This program 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. +;; +;; This program 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 this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth +;; Floor, Boston, MA 02110-1301, USA. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Code: + +(eval-when-compile (require 'appmenu)) + +(defun tyda-lookup-word (word) + "Look up word WORD at URL `http://tyda.se/'. +This site translates between English and Swedish. The site will +be opened in your webbrowser with WORD looked up." + (interactive (list (or (thing-at-point 'word) + (read-string "Lookup word: ")))) + ;; http://tyda.se/search?form=1&w=weird&w_lang=&x=0&y=0 + (browse-url + ;;(concat "http://www.tyda.se/?rid=651940&w=" word) + (format "http://tyda.se/search?form=1&w=%s&w_lang=&x=0&y=0" word) + )) + +(defvar tyda-appmenu-map + (let ((map (make-sparse-keymap))) + (define-key map [tyda-lookup] + (list 'menu-item "Lookup word at point in Tyda" + 'tyda-lookup-word)) + map)) + +(defvar tyda-mode-map + (let ((map (make-sparse-keymap))) + (define-key map [(alt mouse-1)] 'tyda-lookup-word) + (define-key map [(control ?c) ?=] 'tyda-lookup-word) + map)) + +;;;###autoload +(define-minor-mode tyda-mode + "Minor mode for key bindings for `tyda-lookup-word'. +It binds Alt-Mouse-1 just as the Tyda add-on does in Firefox. +Here are all key bindings + +\\{tyda-mode-map} +" + :global t + (if tyda-mode + (progn + (require 'appmenu nil t) + (when (featurep 'appmenu) + (appmenu-add 'tyda nil tyda-mode "Lookup word" tyda-appmenu-map))))) + + +(provide 'tyda) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; tyda.el ends here -- cgit v1.2.3-54-g00ecf