Commits

cvs2hg  committed ba2c3bd

fixup commit for tag 'sumo-current'

  • Participants
  • Parent commits de384cc
  • Tags sumo-current

Comments (0)

Files changed (4)

+2005-05-10  Norbert Koch  <viteno@xemacs.org>
+
+	* Makefile (VERSION): XEmacs package 1.16 released.
+
+2004-10-04  Norbert Koch  <viteno@xemacs.org>
+
+	* Makefile (VERSION): XEmacs package 1.15 released.
+
+2004-10-02  Torsten Hilbrich  <dictionary@myrkr.in-berlin.de>
+	* dictionary.el: fixed decoding problem when selecting dictionary
+	                 (problem reported by Kuno Strassmann)
+	
+2004-10-01  Norbert Koch  <viteno@xemacs.org>
+
+	* Makefile (VERSION): XEmacs package 1.14 released.
+
+2004-09-29  Norbert Koch  <viteno@xemacs.org>
+
+	* Makefile (VERSION): XEmacs package 1.13 released.
+
+2004-09-25  Torsten Hilbrich  <dictionary@myrkr.in-berlin.de>
+	* dictionary.el: added patch fixing the wrong display of
+	dictionary description (provided by Sergei Pokrovsky)
+	
+	* added dictionary-description-open-delimiter and
+	dictionary-description-close-delimiter (suggested by Sergei
+	Pokrovsky)
+
+2003-06-22  Norbert Koch  <viteno@xemacs.org>
+
+	* Makefile (VERSION): XEmacs package 1.12 released.
+
+2003-06-21  Torsten Hilbrich  <dictionary@myrkr.in-berlin.de>
+
+	* dictionary.el: added variable dictionary-use-single-buffer to
+	control behaviour of dictionary command
+
+	* general: removed some files no longer needed (Makefile.upstream,
+	deb directory)
+
+2002-05-26  Torsten Hilbrich  <dictionary@myrkr.in-berlin.de>
+
+	* dictionary.el: added tool-tip support for XEmacs (based on
+	  balloon-help)
+
 2003-03-09  Ben Wing  <ben@xemacs.org>
 
 	* Makefile:
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-VERSION = 1.11
+VERSION = 1.16
 AUTHOR_VERSION = 1.8
 MAINTAINER = Torsten Hilbrich <dictionary@myrkr.in-berlin.de>
 PACKAGE = dictionary
      * backward moving through the visited definitions
      * in the latest versions of GNU Emacs and XEmacs you get support for
        popup menus
-     * in  GNU Emacs 21 you can lookup words by simply pointing the mouse
-       cursor to them (tool-tips)
+     * in GNU Emacs 21 and XEmacs 21 you can lookup words by simply
+       pointing the mouse cursor to them (tool-tips)
 
-   Here are three sample screenshot showing the dictionary mode in action
-   within an Emacs 21 buffer:
+                           Requirements
 
-   This buffer shows the result of searching the definition for
-   distinguished. A lot of entries have been found, including translation
-   into german and russian language. The blue words are hyper-links that
-   points to the definitions of these words. The hyper-link with the
-   green background will be activated when pressing the middle mouse
-   button.
-   
-   This buffer shows the result of looking for matching words to
-   possible. You can now select one of the found entries or ignore the
-   search by pressing any mouse button outside the menu.
-   
-   This screenshot shows the tool-tips supported in GNU Emacs 21.
-   Whenever the mouse cursor stands still for a certain time (about one
-   second) the word at cursor is looked up in the configured dictionary.
-   This example shows the german translation for originally, in this
-   context not the right one, urspr�nglich would be better.
-
-                           Download and Requirements
-
-   I  have  tested the package with a native GNU Emacs 19.34.1 and XEmacs
-   20.4.  I  implemented  some  hacks  to  work  with  the  very very old
-   custom.el  file  in  the above GNU Emacs. Please update to the current
-   version  whenever possible. XEmacs 21 and Emacs 20 as well as Emacs 21
-   have been tested too.
-     * Current version (1.7.2) of this package
-     * Version 1.5.1 of this package
-     * Version 1.4.1 of this package
-     * Version 1.3.3 of this package
-     * Version 1.2.1 of this package
-     * Version 1.1 of this package
-     * Initial version (1.0) of this package
+   I have tested the package with a native GNU Emacs 19.34.1 and
+   XEmacs 20.4.  I implemented some hacks to work with the very very
+   old custom.el file in the above GNU Emacs. Please update to the
+   current version whenever possible. XEmacs 21 and Emacs 20 as well
+   as Emacs 21 have been tested too.
 
    I  you  want  to  know  more  about the differences please look at the
    ChangeLog.
                              Unpacking the archive
 
    The package is distributed as tar.gz file. You unpack it using:
-gzip -dc dictionary-1.7.2.tar.gz | tar xf -
+
+gzip -dc dictionary-1.8.5.tar.gz | tar xf -
 
    or
-tar -xzf dictionary-1.7.2.tar.gz
+
+tar -xzf dictionary-1.8.5.tar.gz
 
    (with  the  version number subject to change) depending on whether you
    are  using  GNU  tar  which  support the z flag for compression. After
-   unpacking  the  archive  a directory dictionary-1.7.2 has been created
+   unpacking  the  archive  a directory dictionary-1.8.5 has been created
    containing the necessary files.
 
                                  Installation
 
 Debian
 
-   If  you  are using a current Debian distribution (one that support the
-   emacsen  package  system) and have the dpkg-dev installed (for running
-   dpkg-buildpackage) you can use the supplied debian support.
+   If you are using a current Debian distribution (one that support
+   the emacsen package system) and have the build-essential, dpkg-dev,
+   and debmake packages installed (for running dpkg-buildpackage) you
+   can use the supplied debian support.
+
 make debian
 
-   This  will  create  a  package  named  dictionary-1.7.2-1_i386.deb  or
-   similiar  in  the  parent  directory  of dictionary-1.7.2. You can now
+   This  will  create  a  package  named  dictionary-1.8.5-1_all.deb  or
+   similiar  in  the  parent  directory  of dictionary-1.8.5. You can now
    install  this  package  as  root,  it  will automatically byte-compile
    itself  for  all  installed  emacs versions and provide a startup-file
    which autoloads this package. In the configuration example given below
    you can omit the autoload lines.
 
    If you no longer want to use this package, you can remove it using:
+
 dpkg -r dictionary
 
 XEmacs 21
 
    The  XEmacs  version  21  support  so  called  xemacs  packages. These
    packages are also supported, you can create them using:
+
 make EMACS=xemacs package
 
    The created package will be named dictionary-1.5-pkg.tar.gz and stored
    within  the  current  directory.  If  you  don't  want to install this
    package manually, you can use the following command, provided you have
    sufficient privileges (if unsure, login as super user):
+
 make EMACS=xemacs package-install
 
    If  you  have  more  than  one XEmacs versions installed make sure the
    package  as  Debian  package  or  XEmacs  package  you  don't need the
    autoloads,  they are already supplied. Other users I suggest using the
    following lines:
+
 (autoload 'dictionary-search "dictionary"
   "Ask for a word and search it in all dictionaries" t)
 (autoload 'dictionary-match-words "dictionary"
   "Display entries matching the word at the point" t)
 (autoload 'dictionary-tooltip-mode "dictionary"
   "Display tooltips for the current word" t)
-(autoload 'global-dictionary-tooltip-mode "dictionary"
-  "Enable/disable dictionary-tooltip-mode for all buffers" t)
+(unless (boundp 'running-xemacs)
+    (autoload 'global-dictionary-tooltip-mode "dictionary"
+      "Enable/disable dictionary-tooltip-mode for all buffers" t))
 
    In  addition, some key bindings for faster access can be useful. I use
    the following ones in my installation:
+
 ;; key bindings
 (global-set-key "\C-cs" 'dictionary-search)
 (global-set-key "\C-cm" 'dictionary-match-words)
    support this kind of popup menus (you will get an error message if you
    try anyway), XEmacs 20 or prior has not been tested yet.
 
-   A  new  feature of version 1.5 is the tool-tip support. This will only
-   work  in  GNU  Emacs  21,  XEmacs  uses  a different mechanism (called
-   balloon  help)  which  can  not  easily  be  adapted. Please note, the
-   tool-tip mode may slow down your Emacs, especially if you prefer using
-   the mouse.
+   A new feature of version 1.5 is the tool-tip support. This will
+   only work in GNU Emacs 21. Starting from version 1.8.5 this feature
+   is also available in XEmacs. Please note, the tool-tip mode may
+   slow down your Emacs, especially if you prefer using the mouse.
 
-   First  you  have  to  define  the  dictionary  for looking up words to
-   display  in  the  tool-tip  window.  You  could use * to search in all
-   dictionaries, however tool-tip window should be rather small. I use an
-   english  to german dictionary for myself, which is called eng-deu (you
-   can find out the name if you look into contents of the square brackets
-   within  the  dictionary buffer; for example, the line From WordNet (r)
-   1.6[wn]: tells you the name of this dictionary is wn).
-(setq dictionary-tooltip-dictionary "eng-deu")
+   First you have to define the dictionary for looking up words to
+   display in the tool-tip window. You could use * to search in all
+   dictionaries, however tool-tip window should be rather small. I use
+   an english to german dictionary for myself, which is called eng-deu
+   (you can find out the name if you look into contents of the square
+   brackets within the dictionary buffer; for example, the line From
+   WordNet (r) 1.6[wn]: tells you the name of this dictionary is wn).
 
-   Next  you  have  to decide if you want tool-tip support in the current
-   buffer   only   or   in   all   buffers.   For   the   first  use  the
-   dictionary-tooltip-mode       command,       for       the      latter
-   global-dictionary-tooltip-mode.
-;; choose on of the following lines
-(global-dictionary-tooltip-mode 1)
-(dictionary-tooltip-mode 1)
+      (setq dictionary-tooltip-dictionary "eng-deu")
+    
 
-   To  turn the tool-tip support off, call these functions with a numeric
-   argument of 0.
+   In the GNU Emacs implemention you can decide to activate the
+   tool-tip support either globally (global-dictionary-tooltip-mode)
+   or local to a buffer (dictionary-tooltip-mode).
+
+;; global dictionary-mode
+(global-dictionary-tooltip-mode)
+;; activate for all text-based modes
+(add-hook 'text-mode-hook 'dictionary-tooltip-mode)
+    
+
+   In XEmacs only the local version (dictionary-tooltip-mode) is
+   available.
+
+;; activate for all text-based modes
+(add-hook 'text-mode-hook 'dictionary-tooltip-mode)
+
+   To turn the tool-tip support off, call these functions with a
+   numeric argument of 0.
+
+   The mode line includes a Dict marker if this minor mode is active.
 
    If  you  get  an error message that the server could not be contacted,
    please  check  the  values  of  the  variables  dictionary-server  and
    You  should  have  received  a  copy of the GNU General Public License
    version 2 along with this package; see the file GPL.
 
-                                  ChangeLogs
-
-Version 1.7.1 - 1.7.2
-
-     * link.el  (link-initialize-keymap):  fixed keybinding bug (reported
-       by David A. Panariti)
-
-Version 1.7 - 1.7.1
-
-     * fixed  mule-detection in dictionary-coding-system (patch submitted
-       by Robert Pluim)
-
-Version 1.5.1 - 1.7
-
-     * added HTTP proxy support (using the CONNECT method)
-     * added  support for dictionaries not encoded in utf-8 (suggested by
-       Eugene Morozov)
-
-Version 1.5 - 1.5.1
-
-     * fixed bug with non-working dictionary-previous (found by Rui Zhu)
-     * fixed key bindings in link.el
-
-Version 1.4.1 - 1.5
-
-     * tool-tip support for GNU Emacs 21
-
-Version 1.4 - 1.4.1
-
-     * changed recognition of utf-8 support (suggested by Enrico Scholz)
-
-Version 1.3.3 - 1.4
-
-     * added popup menu for easier lookup of words
-
-Version 1.3.2 - 1.3.3
-
-     * added  support  for  XEmacs  21  packages to ease installation for
-       those users (suggested and reviewed by Enrico Scholz)
-
-Version 1.3.1 - 1.3.2
-
-     * replaced   set-text-properties   by   remove-text-properties   and
-       add-text-properties  because  this  function  is  not  recommended
-       within XEmacs (reported by Serge Boiko)
-
-Version 1.3 - 1.3.1
-
-     * small  fix in dictionary function to check for availability of the
-       utf-8  encoding  to  prevent  problems  in certain xemacs versions
-       (reported by Jeff Mincy)
-     * added debian support (use dpkg-buildpackage to build a package)
-
-Version 1.2.1 - 1.3
-
-     * Implemented an automatic detection for line ends CR/LF and LF. The
-       variable  connection-broken-end-of-line is no longer necessary and
-       its value ignored.
-     * Added  utf-8  support,  the native character set of the dictionary
-       protocol.  Using  ISO-8859-1  (aka  latin-1)  was just a necessary
-       work-around.
-
-Version 1.2 - 1.2.1
-
-     * Corrected dictionary command to draw the button bar.
-     * Improved documentation on dictionary to explicitly mention the use
-       of multiple buffers.
-
-Version 1.1.1 - 1.2
-
-     * Some  users  reported  problems with GNU Emacs 20.3 and MULE. So I
-       introduced  a  new  variable  connection-broken-end-of-line  which
-       controls whether a line is ended by \n or by \r\n. You can use the
-       customize-group command on dictionary to change the setting of the
-       variable.
-
-Version 1.1 - 1.1.1
-
-     * dictionary-search now allows editing the word to search for
-     * dictionary-search-word-near-point  has  been  removed, you can use
-       dictionary-lookup-definition     instead.    It    behaves    like
-       dictionary-search but don't allow the search word to be edited (to
-       speed up looking up words).
-
-Version 1.0 - 1.1
-
-     * all dictionary buffers now share a single connection
-     * added kill-all-local-variables
-     * use cons instead of list where possible
-     * dictionary-search now:
-          + use     word    as    point    as    default    (implementing
-            dictionary-search-word-near-point too)
-          + asks for dictionary with prefix argument
-     * added help-echo tags which are used in XEmacs
-     * mark has been replaced by generic marker
-     * added  messages  for  communications to the dictionary server that
-       may take a while
-     * fixed bug with going to the previous link
-     * replaced word-at-point by current-word
-     _________________________________________________________________
-
    E-Mail: dictionary@myrkr.in-berlin.de
-   Last modified: Fri Dec 21 18:51:23 CET 2001

File dictionary.el

- ;; dictionary.el -- an interface to RFC 2229 dictionary server
+;; dictionary.el -- an interface to RFC 2229 dictionary server
 
- ;; Author: Torsten Hilbrich <dictionary@myrkr.in-berlin.de>
- ;; Keywords: interface, dictionary
- ;; $Id$
+;; Author: Torsten Hilbrich <dictionary@myrkr.in-berlin.de>
+;; Keywords: interface, dictionary
+;; $Id$
 
- ;; This file 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 file 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 file 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.
+;; This file 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.
+;; 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.
 
- (eval-when-compile
-   (require 'cl))
+(eval-when-compile
+  (require 'cl))
 
- (require 'easymenu)
- (require 'custom)
- (require 'connection)
- (require 'link)
+(require 'easymenu)
+(require 'custom)
+(require 'connection)
+(require 'link)
 
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; Stuff for customizing.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Stuff for customizing.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
- (eval-when-compile
-   (unless (fboundp 'defface)
-	   (message "Please update your custom.el file: %s"
-		    "http://www.dina.kvl.dk/~abraham/custom/"))
+(eval-when-compile
+  (unless (fboundp 'defface)
+    (message "Please update your custom.el file: %s"
+	     "http://www.dina.kvl.dk/~abraham/custom/"))
+  
+  (unless (fboundp 'defgroup)
+    (defmacro defgroup (&rest ignored))
+    (defmacro defcustom (var value doc &rest ignored)
+      (list 'defvar var value doc))))
 
-   (unless (fboundp 'defgroup)
-	   (defmacro defgroup (&rest ignored))
-	   (defmacro defcustom (var value doc &rest ignored)
-	     (list 'defvar var value doc))))
+(defgroup dictionary nil
+  "Client for accessing the dictd server based dictionaries"
+  :group 'hypermedia)
 
- (defgroup dictionary nil
-   "Client for accessing the dictd server based dictionaries"
-   :group 'hypermedia)
+(defgroup dictionary-proxy nil
+  "Proxy configuration options for the dictionary client"
+  :group 'dictionary)
 
- (defgroup dictionary-proxy nil
-   "Proxy configuration options for the dictionary client"
-   :group 'dictionary)
+(defcustom dictionary-server
+  "dict.org"
+  "This server is contacted for searching the dictionary"
+  :group 'dictionary
+  :type 'string)
 
- (defcustom dictionary-server
-   "dict.org"
-   "This server is contacted for searching the dictionary"
-   :group 'dictionary
-   :type 'string)
+(defcustom dictionary-port
+  2628
+  "The port of the dictionary server.
+ This port is propably always 2628 so there should be no need to modify it."
+  :group 'dictionary
+  :type 'number)
 
- (defcustom dictionary-port
-   2628
-   "The port of the dictionary server.
- This port is propably always 2628 so there should be no need to modify it."
-   :group 'dictionary
-   :type 'number)
+(defcustom dictionary-identification
+  "dictionary.el emacs lisp dictionary client"
+  "This is the identification string that will be sent to the server."
+  :group 'dictionary
+  :type 'string)
 
- (defcustom dictionary-identification
-   "dictionary.el emacs lisp dictionary client"
-   "This is the identification string that will be sent to the server."
-   :group 'dictionary
-   :type 'string)
-
- (defcustom dictionary-default-dictionary
-   "*"
-   "The dictionary which is used for searching definitions and matching.
+(defcustom dictionary-default-dictionary
+  "*"
+  "The dictionary which is used for searching definitions and matching.
  * and ! have a special meaning, * search all dictionaries, ! search until
  one dictionary yields matches."
-   :group 'dictionary
-   :type 'string)
+  :group 'dictionary
+  :type 'string)
 
- (defcustom dictionary-default-strategy
-   "."
-   "The default strategy for listing matching words."
-   :group 'dictionary
-   :type 'string)
+(defcustom dictionary-default-strategy
+  "."
+  "The default strategy for listing matching words."
+  :group 'dictionary
+  :type 'string)
 
 (defcustom dictionary-default-popup-strategy
   "exact"
 		 (const :tag "Levenshtein distance one" "lev")
 		 (string :tag "User choice")))
 
- (defcustom dictionary-create-buttons
-   t
-   "Create some clickable buttons on top of the window if non-nil."
-   :group 'dictionary
-   :type 'boolean)
+(defcustom dictionary-create-buttons
+  t
+  "Create some clickable buttons on top of the window if non-nil."
+  :group 'dictionary
+  :type 'boolean)
 
- (defcustom dictionary-mode-hook
-   nil
-   "Hook run in dictionary mode buffers."
-   :group 'dictionary
-   :type 'hook)
+(defcustom dictionary-mode-hook
+  nil
+  "Hook run in dictionary mode buffers."
+  :group 'dictionary
+  :type 'hook)
 
- (defcustom dictionary-use-http-proxy
-   nil
-   "Connects via a HTTP proxy using the CONNECT command when not nil."
-   :group 'dictionary-proxy
-   :type 'boolean)
+(defcustom dictionary-use-http-proxy
+  nil
+  "Connects via a HTTP proxy using the CONNECT command when not nil."
+  :group 'dictionary-proxy
+  :type 'boolean)
 
- (defcustom dictionary-proxy-server
-   "proxy"
-   "The name of the HTTP proxy to use when dictionary-use-http-proxy is set."
-   :group 'dictionary-proxy
-   :type 'string)
+(defcustom dictionary-proxy-server
+  "proxy"
+  "The name of the HTTP proxy to use when dictionary-use-http-proxy is set."
+  :group 'dictionary-proxy
+  :type 'string)
 
- (defcustom dictionary-proxy-port
-   3128
-   "The port of the proxy server, used only when dictionary-use-http-proxy is set."
-   :group 'dictionary-proxy
-   :type 'number)
+(defcustom dictionary-proxy-port
+  3128
+  "The port of the proxy server, used only when dictionary-use-http-proxy is set."
+  :group 'dictionary-proxy
+  :type 'number)
+
+(defcustom dictionary-use-single-buffer
+  nil
+  "Should the dictionary command reuse previous dictionary buffers?"
+  :group 'dictionary
+  :type 'boolean)
+
+(defcustom dictionary-description-open-delimiter
+  ""
+  "The delimiter to display in front of the dictionaries description"
+  :group 'dictionary
+  :type 'string)
+
+(defcustom dictionary-description-close-delimiter
+  ""
+  "The delimiter to display after of the dictionaries description"
+  :group 'dictionary
+  :type 'string)
 
 ;; Define only when coding-system-list is available
 (when (fboundp 'coding-system-list)
 				 ,@(mapcar (lambda (x) (list 'const x))
 					   (coding-system-list))
 				 ))))
+  
+  )
 
-)
+(if (fboundp 'defface)
+    (progn
+      
+      (defface dictionary-word-entry-face
+	'((((type x))
+	   (:italic t))
+	  (((type tty) (class color))
+	   (:foreground "green"))
+	  (t
+	   (:inverse t)))
+	"The face that is used for displaying the initial word entry line."
+	:group 'dictionary)
+      
+      (defface dictionary-button-face
+	'((t
+	   (:bold t)))
+	"The face that is used for displaying buttons."
+	:group 'dictionary)
+      
+      (defface dictionary-reference-face
+	'((((type x)
+	    (class color)
+	    (background dark))
+	   (:foreground "yellow"))
+	  (((type tty)
+	    (class color)
+	    (background dark))
+	   (:foreground "cyan"))
+	  (((class color)
+	    (background light))
+	   (:foreground "blue"))
+	  (t
+	   (:underline t)))
+	
+	"The face that is used for displaying a reference word."
+	:group 'dictionary)
+      
+      )
+  
+  ;; else
+  (copy-face 'italic 'dictionary-word-entry-face)
+  (copy-face 'bold 'dictionary-button-face)
+  (copy-face 'default 'dictionary-reference-face)
+  (set-face-foreground 'dictionary-reference-face "blue"))
 
- (if (fboundp 'defface)
-     (progn
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Buffer local variables for storing the current state
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
- (defface dictionary-word-entry-face
-   '((((type x))
-      (:italic t))
-     (((type tty) (class color))
-      (:foreground "green"))
-     (t
-      (:inverse t)))
-   "The face that is used for displaying the initial word entry line."
-   :group 'dictionary)
+(defvar dictionary-window-configuration
+  nil
+  "The window configuration to be restored upon closing the buffer")
 
- (defface dictionary-button-face
-   '((t
-      (:bold t)))
-   "The face that is used for displaying buttons."
-   :group 'dictionary)
+(defvar dictionary-selected-window
+  nil
+  "The currently selected window")
 
- (defface dictionary-reference-face
-   '((((type x)
-       (class color)
-       (background dark))
-      (:foreground "yellow"))
-     (((type tty)
-       (class color)
-       (background dark))
-      (:foreground "cyan"))
-     (((class color)
-       (background light))
-      (:foreground "blue"))
-     (t
-      (:underline t)))
+(defvar dictionary-position-stack
+  nil
+  "The history buffer for point and window position")
 
-   "The face that is used for displaying a reference word."
-   :group 'dictionary)
+(defvar dictionary-data-stack
+  nil
+  "The history buffer for functions and arguments")
 
- )
+(defvar dictionary-positions
+  nil
+  "The current positions")
 
- ;; else
- (copy-face 'italic 'dictionary-word-entry-face)
- (copy-face 'bold 'dictionary-button-face)
- (copy-face 'default 'dictionary-reference-face)
- (set-face-foreground 'dictionary-reference-face "blue"))
+(defvar dictionary-current-data
+  nil
+  "The item that will be placed on stack next time")
 
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; Buffer local variables for storing the current state
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Global variables
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defvar dictionary-mode-map
+  nil
+  "Keymap for dictionary mode")
 
- (defvar dictionary-window-configuration
-   nil
-   "The window configuration to be restored upon closing the buffer")
+(defvar dictionary-connection 
+  nil
+  "The current network connection")
 
- (defvar dictionary-selected-window
-   nil
-   "The currently selected window")
+(defvar dictionary-instances
+  0
+  "The number of open dictionary buffers")
 
- (defvar dictionary-position-stack
-   nil
-   "The history buffer for point and window position")
+(defvar dictionary-marker 
+  nil
+  "Stores the point position while buffer display.")
 
- (defvar dictionary-data-stack
-   nil
-   "The history buffer for functions and arguments")
+(defvar dictionary-color-support 
+  (condition-case nil
+      (x-display-color-p)
+    (error nil))
+  "Stores the point position while buffer display.")
 
- (defvar dictionary-positions
-   nil
-   "The current positions")
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Basic function providing startup actions
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
- (defvar dictionary-current-data
-   nil
-   "The item that will be placed on stack next time")
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; Global variables
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- (defvar dictionary-mode-map
-   nil
-   "Keymap for dictionary mode")
-
- (defvar dictionary-connection 
-   nil
-   "The current network connection")
-
- (defvar dictionary-instances
-   0
-   "The number of open dictionary buffers")
-
- (defvar dictionary-marker 
-   nil
-   "Stores the point position while buffer display.")
-
- (defvar dictionary-color-support 
-   (condition-case nil
-       (x-display-color-p)
-     (error nil))
-   "Stores the point position while buffer display.")
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; Basic function providing startup actions
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;;;###autoload
- (defun dictionary-mode ()
-   "This is a mode for searching a dictionary server implementing
+;;;###autoload
+(defun dictionary-mode ()
+  "This is a mode for searching a dictionary server implementing
  the protocol defined in RFC 2229.
 
  This is a quick reference to this mode describing the default key bindings:
  * Return or Button2 visit that link
  * M-Return or M-Button2 search the word beneath link in all dictionaries
  "
+  
+  (unless (eq major-mode 'dictionary-mode)
+    (incf dictionary-instances))
+  
+  (kill-all-local-variables)
+  (buffer-disable-undo)
+  (use-local-map dictionary-mode-map)
+  (setq major-mode 'dictionary-mode)
+  (setq mode-name "Dictionary")
+  
+  (make-local-variable 'dictionary-data-stack)
+  (setq dictionary-data-stack nil)
+  (make-local-variable 'dictionary-position-stack)
+  (setq dictionary-position-stack nil)
+  
+  (make-local-variable 'dictionary-current-data)
+  (make-local-variable 'dictionary-positions)
+  
+  (make-local-variable 'dictionary-default-dictionary)
+  (make-local-variable 'dictionary-default-strategy)
+  
+  (make-local-hook 'kill-buffer-hook)
+  (add-hook 'kill-buffer-hook 'dictionary-close t t)
+  (run-hooks 'dictionary-mode-hook))
 
-   (unless (eq major-mode 'dictionary-mode)
-     (incf dictionary-instances))
-
-   (kill-all-local-variables)
-   (buffer-disable-undo)
-   (use-local-map dictionary-mode-map)
-   (setq major-mode 'dictionary-mode)
-   (setq mode-name "Dictionary")
-
-   (make-local-variable 'dictionary-data-stack)
-   (setq dictionary-data-stack nil)
-   (make-local-variable 'dictionary-position-stack)
-   (setq dictionary-position-stack nil)
-
-   (make-local-variable 'dictionary-current-data)
-   (make-local-variable 'dictionary-positions)
-
-   (make-local-variable 'dictionary-default-dictionary)
-   (make-local-variable 'dictionary-default-strategy)
-
-   (make-local-hook 'kill-buffer-hook)
-   (add-hook 'kill-buffer-hook 'dictionary-close t t)
-   (run-hooks 'dictionary-mode-hook))
-
- ;;;###autoload
- (defun dictionary ()
-   "Create a new dictonary buffer and install dictionary-mode"
-   (interactive)
-   (let ((buffer (generate-new-buffer "*Dictionary buffer*"))
-	 (window-configuration (current-window-configuration))
-	 (selected-window (frame-selected-window)))
-     
-     (switch-to-buffer-other-window buffer)
-     (dictionary-mode)
-     
-     (make-local-variable 'dictionary-window-configuration)
-     (make-local-variable 'dictionary-selected-window)
-     (setq dictionary-window-configuration window-configuration)
-     (setq dictionary-selected-window selected-window)
-     (dictionary-check-connection)
-     (dictionary-new-buffer)
-     (dictionary-store-positions)
-     (dictionary-store-state 'dictionary-new-buffer nil)))
+;;;###autoload
+(defun dictionary ()
+  "Create a new dictonary buffer and install dictionary-mode"
+  (interactive)
+  (let ((buffer (or (and dictionary-use-single-buffer 
+			 (get-buffer "*Dictionary buffer*"))
+		    (generate-new-buffer "*Dictionary buffer*")))
+	(window-configuration (current-window-configuration))
+	(selected-window (frame-selected-window)))
+    
+    (switch-to-buffer-other-window buffer)
+    (dictionary-mode)
+    
+    (make-local-variable 'dictionary-window-configuration)
+    (make-local-variable 'dictionary-selected-window)
+    (setq dictionary-window-configuration window-configuration)
+    (setq dictionary-selected-window selected-window)
+    (dictionary-check-connection)
+    (dictionary-new-buffer)
+    (dictionary-store-positions)
+    (dictionary-store-state 'dictionary-new-buffer nil)))
 
 (defun dictionary-new-buffer (&rest ignore)
   "Create a new and clean buffer"
-
+  
   (dictionary-pre-buffer)
   (dictionary-post-buffer))
 
 (unless dictionary-mode-map
   (setq dictionary-mode-map (make-sparse-keymap))
   (suppress-keymap dictionary-mode-map)
-
+  
   (define-key dictionary-mode-map "q" 'dictionary-close)
   (define-key dictionary-mode-map "h" 'dictionary-help)
   (define-key dictionary-mode-map "s" 'dictionary-search)
   (define-key dictionary-mode-map "M" 'dictionary-select-strategy)
   (define-key dictionary-mode-map "m" 'dictionary-match-words)
   (define-key dictionary-mode-map "l" 'dictionary-previous)
-
+  
   (if (and (string-match "GNU" (emacs-version))
 	   (not window-system))
       (define-key dictionary-mode-map [9] 'dictionary-next-link)
     (define-key dictionary-mode-map [tab] 'dictionary-next-link))
-
+  
   ;; shift-tabs normally is supported on window systems only, but
   ;; I do not enforce it
   (define-key dictionary-mode-map [(shift tab)] 'dictionary-prev-link)
   
   (define-key dictionary-mode-map "n" 'dictionary-next-link)
   (define-key dictionary-mode-map "p" 'dictionary-prev-link)
-
+  
   (define-key dictionary-mode-map " " 'scroll-up)
   (define-key dictionary-mode-map [(meta space)] 'scroll-down)
+  
+  (link-initialize-keymap dictionary-mode-map))
 
-  (link-initialize-keymap dictionary-mode-map))
-  
 (defun dictionary-check-connection ()
   "Check if there is already a connection open"
   (if (not (and dictionary-connection
 		    (connection-open dictionary-proxy-server 
 				     dictionary-proxy-port)
 		  (connection-open dictionary-server dictionary-port)))
-
+	  
 	  (when dictionary-use-http-proxy
 	    (message "Proxy CONNECT to %s:%d" 
 		     dictionary-proxy-server
 					     dictionary-port))
 	    ;; just a \r\n combination
 	    (dictionary-send-command "")
-
+	    
 	    ;; read first line of reply
 	    (let* ((reply (dictionary-read-reply))
 		   (reply-list (dictionary-split-string reply)))
 	      ;; skip the following header lines until empty found
 	      (while (not (equal reply ""))
 		(setq reply (dictionary-read-reply)))))
-
+	  
 	  (dictionary-check-initial-reply)
 	  (dictionary-send-command (concat "client " dictionary-identification))
 	  (let ((reply (dictionary-read-reply-and-split)))
 	(if (= (aref string 0) ?\")
 	    (setq search "\\(\"\\)\\s-*"
 		  start 1))
-      (if (string-match search string start)
-	  (progn
-	    (setq list (cons (substring string start (- (match-end 1) 1)) list)
-		  string (substring string (match-end 0))))
-	(setq list (cons string list)
-	      string nil))))
+	(if (string-match search string start)
+	    (progn
+	      (setq list (cons (substring string start (- (match-end 1) 1)) list)
+		    string (substring string (match-end 0))))
+	  (setq list (cons string list)
+		string nil))))
     (nreverse list)))
 
 (defun dictionary-read-reply-and-split ()
       (setq start (1- (match-end 0))))
     (setq start 0)
     (if (string-match "\n\\.\n.*" answer start)
-      (setq answer (replace-match "" t t answer)))
+	(setq answer (replace-match "" t t answer)))
     answer))
 
 (defun dictionary-check-reply (reply code)
   "Stores the current positions for later restore."
   
   (setq dictionary-positions (cons (point) (window-start))))
-  
+
 ;; Restore the previous state
 (defun dictionary-restore-state (&rest ignored)
   "Restore the state just before the last operation"
     (set-window-start (selected-window) (cdr position))
     (goto-char (car position))
     (setq dictionary-current-data data)))
-      
+
 ;; The normal search
 
 (defun dictionary-new-search (args &optional all)
   (dictionary-store-positions)
   (let ((word (car args))
 	(dictionary (cdr args)))
-
+    
     (if all
 	(setq dictionary dictionary-default-dictionary))
     (dictionary-ensure-buffer)
 
 (defun dictionary-do-search (word dictionary function &optional nomatching)
   "The workhorse for doing the search"
-
+  
   (message "Searching for %s in %s" word dictionary)
   (dictionary-send-command (concat "define " dictionary " \""
 				   (dictionary-encode-charset word dictionary)
 				   "\""))
-
+  
   (message nil)
   (let ((reply (dictionary-read-reply-and-split)))
     (if (dictionary-check-reply reply 552)
 	(progn
 	  (unless nomatching
 	    (beep)
-	    (insert "Word not found, maybe you look "
+	    (insert "Word not found, maybe you are looking "
 		    "for one of these words\n\n")
 	    (dictionary-do-matching word
 				    dictionary
 			  'dictionary-search nil
 			  "Mouse-2 to look up a new word")
 	(insert "         ")
-
+	
 	(link-insert-link "[Matching words]"
 			  'dictionary-button-face
 			  'dictionary-match-words nil
 			  "Mouse-2 to find matches for a pattern")
 	(insert "        ")
-
+	
 	(link-insert-link "[Quit]" 'dictionary-button-face 
 			  'dictionary-close nil
 			  "Mouse-2 to close this window")
-
+	
 	(insert "\n       ")
-
+	
 	(link-insert-link "[Select Dictionary]"
 			  'dictionary-button-face
 			  'dictionary-select-dictionary nil
 (defun dictionary-display-word-entry (word dictionary description)
   "Insert an explanation for the current definition."
   (let ((start (point)))
-    (insert "From " description "[" dictionary "]:\n\n")
+    (insert "From " 
+	    dictionary-description-open-delimiter
+	    (dictionary-decode-charset description dictionary) 
+	    dictionary-description-close-delimiter
+	    " [" (dictionary-decode-charset dictionary dictionary) "]:"
+	    "\n\n")
     (put-text-property start (point) 'face 'dictionary-word-entry-face)))
 
 (defun dictionary-display-word-definition (reply word dictionary)
 
 (defun dictionary-do-select-dictionary (&rest ignored)
   "The workhorse for doing the dictionary selection."
-
+  
   (message "Looking up databases and descriptions")
   (dictionary-send-command "show db")
-
+  
   (let ((reply (dictionary-read-reply-and-split)))
     (message nil)
     (if (dictionary-check-reply reply 554)
   "Display a single dictionary"
   (let* ((list (dictionary-split-string string))
 	 (dictionary (car list))
-	 (description (cadr list)))
+	 (description (cadr list))
+	 (translated (dictionary-decode-charset description dictionary)))
     (if dictionary
 	(progn
-	  (link-insert-link description 'dictionary-reference-face
+	  (link-insert-link (concat dictionary ": " translated)
+			    'dictionary-reference-face
 			    'dictionary-set-dictionary 
 			    (cons dictionary description)
 			    "Mouse-2 to select this dictionary")
 	  (insert "\n")))))
-    
+
 (defun dictionary-set-dictionary (param &optional more)
   "Select this dictionary as new default"
-
+  
   (if more
       (dictionary-display-more-info param)
     (let ((dictionary (car param)))
       (setq dictionary-default-dictionary dictionary)
       (dictionary-restore-state)
       (message "Dictionary %s has been selected" dictionary))))
-    
+
 (defun dictionary-display-more-info (param)
   "Display the available information on the dictionary"
   
 
 (defun dictionary-do-select-strategy ()
   "The workhorse for doing the strategy selection."
-
+  
   (message "Request existing matching algorithm")
   (dictionary-send-command "show strat")
-
+  
   (let ((reply (dictionary-read-reply-and-split)))
     (message nil)
     (if (dictionary-check-reply reply 555)
 			    'dictionary-set-strategy strategy
 			    "Mouse-2 to select this matching algorithm")
 	  (insert "\n")))))
-    
+
 (defun dictionary-set-strategy (strategy &rest ignored)
   "Select this strategy as new default"
   (setq dictionary-default-strategy strategy)
   (dictionary-restore-state)
   (message "Strategy %s has been selected" strategy))
-    
+
 (defun dictionary-new-matching (word)
   "Run a new matching search on `word'."
   (dictionary-ensure-buffer)
       (error "Unknown server answer: %s" (dictionary-reply reply)))
     (funcall function reply)))
 
-(defun dictionary-display-match-result (reply)
-  "Display the results from the current matches."
-  (dictionary-pre-buffer)
-  (dictionary-display-only-match-result reply)
-  (dictionary-post-buffer))
-
 (defun dictionary-display-only-match-result (reply)
   "Display the results from the current matches without the headers."
-
+  
   (let ((number (nth 1 (dictionary-reply-list reply)))
 	(list (dictionary-simple-split-string (dictionary-read-answer) "\n+")))
     (insert number " matching word" (if (equal number "1") "" "s")
 		  (if dictionary
 		      (if hash
 			  (setcdr hash (cons word (cdr hash)))
-		    (setq result (cons 
-				  (cons dictionary (list word)) 
-				  result))))))
+			(setq result (cons 
+				      (cons dictionary (list word)) 
+				      result))))))
 	      list)
       (dictionary-display-match-lines (reverse result)))))
 
 (defun dictionary-display-match-result (reply)
   "Display the results from the current matches."
   (dictionary-pre-buffer)
-
+  
   (let ((number (nth 1 (dictionary-reply-list reply)))
 	(list (dictionary-simple-split-string (dictionary-read-answer) "\n+")))
     (insert number " matching word" (if (equal number "1") "" "s")
 		  (if dictionary
 		      (if hash
 			  (setcdr hash (cons word (cdr hash)))
-		    (setq result (cons 
-				  (cons dictionary (list word)) 
-				  result))))))
+			(setq result (cons 
+				      (cons dictionary (list word)) 
+				      result))))))
 	      list)
       (dictionary-display-match-lines (reverse result))))
   (dictionary-post-buffer))
 					  "Mouse-2 to lookup word")
 			(insert "\n")) (reverse word-list))
 	      (insert "\n")))
-	    list))
-	   
+	  list))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; User callable commands
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 	 (if current-prefix-arg
 	     (read-string "Dictionary: " dictionary-default-dictionary)
 	   dictionary-default-dictionary)))
-
+  
   ;; if called by pressing the button
   (unless word
     (setq word (read-string "Search word: ")))
 (defun dictionary-process-popup-replies (reply)
   (let ((number (nth 1 (dictionary-reply-list reply)))
 	(list (dictionary-simple-split-string (dictionary-read-answer) "\n+")))
-
+    
     (let ((result (mapcar (lambda (item)
 			    (let* ((list (dictionary-split-string item))
 				   (dictionary (car list))
 					`(dictionary-new-search 
 					  '(,word . ,dictionary))
 					t ))))
-				
+			  
 			  list)))
       (let ((menu (make-sparse-keymap 'dictionary-popup)))
 	
 
 ;;; Tooltip support
 
+;; Common to GNU Emacs and XEmacs
+
+;; Add a mode indicater named "Dict"
+(defvar dictionary-tooltip-mode
+  nil
+  "Indicates wheather the dictionary tooltip mode is active")
+(nconc minor-mode-alist '((dictionary-tooltip-mode " Dict")))
+
+(defcustom dictionary-tooltip-dictionary
+  nil
+  "This dictionary to lookup words for tooltips"
+  :group 'dictionary
+  :type 'string)
+
 (defun dictionary-definition (word &optional dictionary)
   (interactive)
   (unwind-protect
   (let ((list (dictionary-simple-split-string (dictionary-read-answer) "\n+")))
     (mapconcat 'identity (cdr list) "\n")))
 
-(defcustom dictionary-tooltip-dictionary
-  nil
-  "This dictionary to lookup words for tooltips"
-  :group 'dictionary
-  :type 'string)
+(defconst dictionary-use-balloon-help 
+  (eval-when-compile
+    (condition-case nil
+	(require 'balloon-help)
+      (error nil))))
 
+(if dictionary-use-balloon-help
+    (progn
+
+;; The following definition are only valid for XEmacs with balloon-help 
+
+(defvar dictionary-balloon-help-position nil
+  "Current position to lookup word")
+
+(defun dictionary-balloon-help-store-position (event)
+  (setq dictionary-balloon-help-position (event-point event)))
+
+(defun dictionary-balloon-help-description (&rest extent)
+  "Get the word from the cursor and lookup it"
+  (if dictionary-balloon-help-position
+      (let ((word (save-window-excursion
+		    (save-excursion
+		      (goto-char dictionary-balloon-help-position)
+		      (current-word)))))
+	(let ((definition
+		(dictionary-definition word dictionary-tooltip-dictionary)))
+	  (if definition
+	      (dictionary-decode-charset definition
+					 dictionary-tooltip-dictionary)
+	    nil)))))
+
+(defvar dictionary-balloon-help-extent nil
+  "The extent for activating the balloon help")
+
+(make-variable-buffer-local 'dictionary-balloon-help-extent)
+
+;;;###autoload
+(defun dictionary-tooltip-mode (&optional arg)
+   "Display tooltips for the current word"
+   (interactive "P")
+   (let* ((on (if arg
+		  (> (prefix-numeric-value arg) 0)
+		(not dictionary-tooltip-mode))))
+     (make-local-variable 'dictionary-tooltip-mode)
+     (if on
+	 ;; active mode
+	 (progn
+	   ;; remove old extend
+	   (if dictionary-balloon-help-extent
+	       (delete-extent dictionary-balloon-help-extent))
+	   ;; create new one
+	   (setq dictionary-balloon-help-extent (make-extent (point-min)
+							     (point-max)))
+	   (set-extent-property dictionary-balloon-help-extent
+				'balloon-help 
+				'dictionary-balloon-help-description)
+	   (set-extent-property dictionary-balloon-help-extent
+				'start-open nil)
+	   (set-extent-property dictionary-balloon-help-extent
+				'end-open nil)
+	   (add-hook 'mouse-motion-hook
+		     'dictionary-balloon-help-store-position))
+
+       ;; deactivate mode
+       (if dictionary-balloon-help-extent
+	   (delete-extent dictionary-balloon-help-extent))
+       (remove-hook 'mouse-motion-hook
+		     'dictionary-balloon-help-store-position))
+     (setq dictionary-tooltip-mode on)
+     (balloon-help-minor-mode on)))
+
+) ;; end of XEmacs part
+
+(defvar global-dictionary-tooltip-mode
+  nil)
+
+;;; Tooltip support for GNU Emacs
 (defun dictionary-display-tooltip (event)
   "Search the current word in the `dictionary-tooltip-dictionary'."
   (interactive "e")
   (if dictionary-tooltip-dictionary
       (let ((word (save-window-excursion
-		    (save-excursion
-		      (mouse-set-point event)
-		      (current-word)))))
-	(let ((definition 
-		(dictionary-definition word dictionary-tooltip-dictionary)))
-	  (if definition 
-	      (tooltip-show 
-	       (dictionary-decode-charset definition 
-					  dictionary-tooltip-dictionary)))
-	  t))
+ 		    (save-excursion
+ 		      (mouse-set-point event)
+ 		      (current-word)))))
+ 	(let ((definition 
+ 		(dictionary-definition word dictionary-tooltip-dictionary)))
+ 	  (if definition 
+ 	      (tooltip-show 
+ 	       (dictionary-decode-charset definition 
+ 					  dictionary-tooltip-dictionary)))
+ 	  t))
     nil))
 
-(defvar dictionary-tooltip-mode
-  nil)
-
 ;;;###autoload
 (defun dictionary-tooltip-mode (&optional arg)
   "Display tooltips for the current word"
   (interactive "P")
   (require 'tooltip)
-  (let* ((on (if arg
-		 (> (prefix-numeric-value arg) 0)
-	       (not dictionary-tooltip-mode)))
-	 (hook-fn (if on 'add-hook 'remove-hook)))
-    (tooltip-mode on)
-    (funcall hook-fn 'tooltip-hook 'dictionary-display-tooltip)
-    (tooltip-activate-mouse-motions on)))
+  (let ((on (if arg
+		(> (prefix-numeric-value arg) 0)
+	      (not dictionary-tooltip-mode))))
+    (make-local-variable 'dictionary-tooltip-mode)
+    (setq dictionary-tooltip-mode on)
+    ;; make sure that tooltip is still (global available) even is on
+    ;; if nil
+    (tooltip-mode 1)
+    (add-hook 'tooltip-hook 'dictionary-display-tooltip)
+    (make-local-variable 'track-mouse)
+    (setq track-mouse on)))
 
 ;;;###autoload
 (defun global-dictionary-tooltip-mode (&optional arg)
   "Enable/disable dictionary-tooltip-mode for all buffers"
   (interactive "P")
-  (let ((on (if arg (> (prefix-numeric-value arg) 0)
-	      (not dictionary-tooltip-mode))))
-    (dictionary-tooltip-mode on)
-    (tooltip-activate-mouse-motions on)
+  (require 'tooltip)
+  (let* ((on (if arg (> (prefix-numeric-value arg) 0)
+ 	      (not global-dictionary-tooltip-mode)))
+ 	 (hook-fn (if on 'add-hook 'remove-hook)))
+    (setq global-dictionary-tooltip-mode on)
+    (tooltip-mode 1)
+    (funcall hook-fn 'tooltip-hook 'dictionary-display-tooltip)
+    (setq-default dictionary-tooltip-mode on)
     (setq-default track-mouse on)))
 
+) ;; end of GNU Emacs part
+
 (provide 'dictionary)