comparison lisp/w3/w3-xemac.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents e04119814345
children 1ce6082ce73f
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
1 ;;; w3-xemac.el --- XEmacs specific functions for emacs-w3 1 ;;; w3-xemac.el --- XEmacs specific functions for emacs-w3
2 ;; Author: wmperry 2 ;; Author: wmperry
3 ;; Created: 1997/03/09 01:59:33 3 ;; Created: 1996/07/21 06:38:10
4 ;; Version: 1.16 4 ;; Version: 1.4
5 ;; Keywords: faces, help, mouse, hypermedia 5 ;; Keywords: faces, help, mouse, hypermedia
6 6
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;; Copyright (c) 1993 - 1996 by William M. Perry (wmperry@cs.indiana.edu) 8 ;;; Copyright (c) 1993 - 1996 by William M. Perry (wmperry@cs.indiana.edu)
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
10 ;;; 9 ;;;
11 ;;; This file is part of GNU Emacs. 10 ;;; This file is part of GNU Emacs.
12 ;;; 11 ;;;
13 ;;; GNU Emacs is free software; you can redistribute it and/or modify 12 ;;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;;; it under the terms of the GNU General Public License as published by 13 ;;; it under the terms of the GNU General Public License as published by
19 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details. 20 ;;; GNU General Public License for more details.
22 ;;; 21 ;;;
23 ;;; You should have received a copy of the GNU General Public License 22 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Emacs; see the file COPYING. If not, write to the 23 ;;; along with GNU Emacs; see the file COPYING. If not, write to
25 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 24 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26 ;;; Boston, MA 02111-1307, USA.
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28 26
29 (require 'w3-imap) 27 (require 'w3-imap)
30 (require 'images) 28 (require 'images)
31 (require 'w3-widget) 29 (require 'w3-widget)
32 (require 'w3-menu) 30 (require 'w3-menu)
33 (require 'w3-forms)
34 (require 'w3-script)
35 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
36 ;;; Enhancements For XEmacs 32 ;;; Enhancements For XEmacs
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 33 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 (defun w3-mouse-handler (e) 34 (defun w3-mouse-handler (e)
39 "Function to message the url under the mouse cursor" 35 "Function to message the url under the mouse cursor"
40 (interactive "e") 36 (interactive "e")
41 (let* ((pt (event-point e)) 37 (let* ((pt (event-point e))
42 (good (eq (event-window e) (selected-window))) 38 (good (eq (event-window e) (selected-window)))
43 (mouse-events)) 39 (widget (and good pt (number-or-marker-p pt) (widget-at pt)))
44 (if (not (and good pt (number-or-marker-p pt))) 40 (link (and widget (widget-get widget 'href)))
45 nil 41 (form (and widget (widget-get widget 'w3-form-data)))
46 (if (and inhibit-help-echo w3-track-mouse) 42 (imag nil)
47 (widget-echo-help pt)) 43 )
48 (setq mouse-events (w3-script-find-event-handlers pt 'mouse)) 44 (cond
49 (if (assq 'onmouseover mouse-events) 45 (link (message "%s" link))
50 (w3-script-evaluate-form (cdr (assq 'onmouseover mouse-events))))))) 46 (form
47 (cond
48 ((eq 'submit (w3-form-element-type form))
49 (message "Submit form to %s"
50 (cdr-safe (assq 'action (w3-form-element-action form)))))
51 ((eq 'reset (w3-form-element-type form))
52 (message "Reset form contents"))
53 (t
54 (message "Form entry (name=%s, type=%s)" (w3-form-element-name form)
55 (w3-form-element-type form)))))
56 (imag (message "Inlined image (%s)" (car imag)))
57 (t (message "")))))
51 58
52 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 59 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
53 ;;; Functions to build menus of urls 60 ;;; Functions to build menus of urls
54 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 61 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
55 (defun w3-setup-version-specifics () 62 (defun w3-setup-version-specifics ()
67 (if (featurep 'menubar) 74 (if (featurep 'menubar)
68 (let ((current-menubar (default-value 'current-menubar))) 75 (let ((current-menubar (default-value 'current-menubar)))
69 (if current-menubar 76 (if current-menubar
70 (add-submenu '("Help") (cons "WWW" (cdr w3-menu-help-menu)))))) 77 (add-submenu '("Help") (cons "WWW" (cdr w3-menu-help-menu))))))
71 78
72 ;; FIXME FIXME: Do sexy things to the default modeline for Emacs-W3
73
74 ;; The following is a workaround for XEmacs 19.14 and XEmacs 20.0
75 ;; The text property implementation is badly broken - you could not have
76 ;; a text property with a `nil' value. Bad bad bad.
77 (if (or (and (= emacs-major-version 20)
78 (= emacs-minor-version 0))
79 (and (= emacs-major-version 19)
80 (= emacs-minor-version 14)))
81 (defun text-prop-extent-paste-function (ext from to)
82 (let ((prop (extent-property ext 'text-prop nil))
83 (val nil))
84 (if (null prop)
85 (error "Internal error: no text-prop"))
86 (setq val (extent-property ext prop nil))
87 (put-text-property from to prop val nil)
88 nil))
89 )
90 ) 79 )
91 80
92 (defun w3-store-in-clipboard (str) 81 (defun w3-store-in-clipboard (str)
93 "Store string STR into the clipboard in X" 82 "Store string STR into the clipboard in X"
94 (cond 83 (cond
137 nil)) 126 nil))
138 (and echo (message "%s" echo)))) 127 (and echo (message "%s" echo))))
139 128
140 (defun w3-mode-version-specifics () 129 (defun w3-mode-version-specifics ()
141 "XEmacs specific stuff for w3-mode" 130 "XEmacs specific stuff for w3-mode"
142 (if (featurep 'mouse) 131 (cond
143 (progn 132 ((not w3-track-mouse)
144 (if (not w3-track-mouse) 133 (setq inhibit-help-echo nil))
145 (setq inhibit-help-echo nil)) 134 (inhibit-help-echo
146 (setq mode-motion-hook 'w3-mouse-handler))) 135 (setq mode-motion-hook 'w3-mouse-handler))
147 (case (device-type) 136 (t nil))
148 ((tty stream) ; TTY or batch 137 (if (eq (device-type) 'tty)
149 nil) 138 nil
150 (otherwise 139 (w3-add-toolbar-to-buffer))
151 (w3-add-toolbar-to-buffer)))
152 (setq mode-popup-menu w3-popup-menu)) 140 (setq mode-popup-menu w3-popup-menu))
153 141
154 (require 'w3-toolbar) 142 (require 'w3-toolbar)
155 (provide 'w3-xemacs) 143 (provide 'w3-xemacs)
156 (provide 'w3-xemac) 144 (provide 'w3-xemac)