comparison lisp/w3/w3-e19.el @ 173:8eaf7971accc r20-3b13

Import from CVS: tag r20-3b13
author cvs
date Mon, 13 Aug 2007 09:49:09 +0200
parents 5a88923fcbfe
children 3d6bfa290dbd
comparison
equal deleted inserted replaced
172:a38aed19690b 173:8eaf7971accc
1 ;;; w3-e19.el --- Emacs 19.xx specific functions for emacs-w3 1 ;;; w3-e19.el --- Emacs 19.xx specific functions for emacs-w3
2 ;; Author: wmperry 2 ;; Author: wmperry
3 ;; Created: 1997/05/10 23:01:41 3 ;; Created: 1997/07/08 14:00:33
4 ;; Version: 1.26 4 ;; Version: 1.28
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. 9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
39 ;;; Help menu 39 ;;; Help menu
40 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 40 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
41 (defvar w3-e19-hotlist-menu nil "A menu for hotlists.") 41 (defvar w3-e19-hotlist-menu nil "A menu for hotlists.")
42 (defvar w3-e19-links-menu nil "A buffer-local menu for hyperlinks.") 42 (defvar w3-e19-links-menu nil "A buffer-local menu for hyperlinks.")
43 (defvar w3-e19-nav-menu nil "A buffer-local menu for html based <link> tags.") 43 (defvar w3-e19-nav-menu nil "A buffer-local menu for html based <link> tags.")
44 (defvar w3-e19-window-width nil)
45
44 (mapcar 'make-variable-buffer-local 46 (mapcar 'make-variable-buffer-local
45 '(w3-e19-hotlist-menu w3-e19-links-menu w3-e19-nav-menu)) 47 '(w3-e19-hotlist-menu
48 w3-e19-window-width
49 w3-e19-links-menu
50 w3-e19-nav-menu))
46 51
47 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 52 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
48 ;;; Functions to build menus of urls 53 ;;; Functions to build menus of urls
49 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 54 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
50 (defun w3-e19-show-hotlist-menu () 55 (defun w3-e19-show-hotlist-menu ()
89 ;; Set up routine for emacs 19 94 ;; Set up routine for emacs 19
90 (require 'lmenu) ; for popup-menu 95 (require 'lmenu) ; for popup-menu
91 ) 96 )
92 97
93 (defun w3-store-in-clipboard (str) 98 (defun w3-store-in-clipboard (str)
94 "Store string STR in the Xwindows clipboard" 99 "Store string STR in the system clipboard"
95 (case (device-type) 100 (cond
96 (x (x-select-text str)) 101 ((boundp 'interprogram-cut-function)
97 (pm (pm-put-clipboard str)) 102 (if interprogram-cut-function
98 (ns (ns-store-pasteboard-internal str)) 103 (funcall interprogram-cut-function str t)))
99 (otherwise nil))) 104 (t
105 (case (device-type)
106 (x (x-select-text str))
107 (pm (pm-put-clipboard str))
108 (ns (ns-store-pasteboard-internal str))
109 (otherwise nil)))))
100 110
101 (defun w3-e19-no-read-only (st nd) 111 (defun w3-e19-no-read-only (st nd)
102 ;; Make sure we don't yank any read-only data out of this buffer 112 ;; Make sure we don't yank any read-only data out of this buffer
103 (let ((inhibit-read-only t)) 113 (let ((inhibit-read-only t)
114 (after-change-functions nil)
115 (after-change-function nil))
116 (put-text-property st nd 'w3-munged-ro t)
104 (put-text-property st nd 'read-only nil))) 117 (put-text-property st nd 'read-only nil)))
105 118
106 (defun w3-mode-version-specifics () 119 (defun w3-mode-version-specifics ()
107 ;; Emacs 19 specific stuff for w3-mode 120 ;; Emacs 19 specific stuff for w3-mode
108 (declare (special w3-face-index w3-display-background-properties)) 121 (declare (special w3-face-index w3-display-background-properties))
109 (make-local-variable 'track-mouse) 122 (make-local-variable 'track-mouse)
110 ;(set (make-local-variable 'buffer-access-fontify-functions) 'w3-e19-no-read-only) 123 (set (make-local-variable 'buffer-access-fontify-functions) 'w3-e19-no-read-only)
124 (set (make-local-variable 'buffer-access-fontified-property) 'w3-munged-ro)
125 (setq w3-e19-window-width (window-width))
111 (if w3-track-mouse (setq track-mouse t)) 126 (if w3-track-mouse (setq track-mouse t))
112 (if w3-display-background-properties 127 (if w3-display-background-properties
113 (let ((face (w3-make-face (intern 128 (let ((face (w3-make-face (intern
114 (format "w3-style-face-%05d" w3-face-index)) 129 (format "w3-style-face-%05d" w3-face-index))
115 "An Emacs-W3 face... don't edit by hand." t)) 130 "An Emacs-W3 face... don't edit by hand." t))
137 ;; Need to handle onmouseover, on mouseout 152 ;; Need to handle onmouseover, on mouseout
138 (setq mouse-events (w3-script-find-event-handlers pt 'mouse)) 153 (setq mouse-events (w3-script-find-event-handlers pt 'mouse))
139 (if (assq 'onmouseover mouse-events) 154 (if (assq 'onmouseover mouse-events)
140 (w3-script-evaluate-form (cdr (assq 'onmouseover mouse-events))))))) 155 (w3-script-evaluate-form (cdr (assq 'onmouseover mouse-events)))))))
141 156
157 (defun w3-window-size-change-function (frame)
158 (let ((first (frame-first-window frame))
159 (cur nil))
160 (while (not (eq cur first))
161 (setq cur (if cur (next-window cur nil frame) first))
162 (save-excursion
163 (set-buffer (window-buffer cur))
164 (if (and (eq major-mode 'w3-mode)
165 (not (eq (window-width cur) w3-e19-window-width)))
166 (w3-refresh-buffer))))))
167
142 168
143 (provide 'w3-emacs19) 169 (provide 'w3-emacs19)
144 (provide 'w3-e19) 170 (provide 'w3-e19)