Mercurial > hg > xemacs-beta
comparison lisp/w3/w3-emulate.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-emulate.el --- All variable definitions for emacs-w3 | 1 ;;; w3-emulate.el --- All variable definitions for emacs-w3 |
2 ;; Author: wmperry | 2 ;; Author: wmperry |
3 ;; Created: 1997/03/14 06:12:02 | 3 ;; Created: 1996/06/30 18:05:22 |
4 ;; Version: 1.12 | 4 ;; Version: 1.2 |
5 ;; Keywords: comm, help, hypermedia | 5 ;; Keywords: comm, help, hypermedia |
6 | 6 |
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu) | 8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu) |
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc. | 9 ;;; |
10 ;;; | 10 ;;; This file is not part of GNU Emacs, but the same permissions apply. |
11 ;;; 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 |
15 ;;; the Free Software Foundation; either version 2, or (at your option) | 14 ;;; the Free Software Foundation; either version 2, or (at your option) |
16 ;;; any later version. | 15 ;;; any later version. |
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
30 ;;; Provide emulations of various other web browsers | 28 ;;; Provide emulations of various other web browsers |
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
78 (define-key w3-netscape-emulation-minor-mode-map [down] | 76 (define-key w3-netscape-emulation-minor-mode-map [down] |
79 (function (lambda () (interactive) (scroll-up 1)))) | 77 (function (lambda () (interactive) (scroll-up 1)))) |
80 (define-key w3-netscape-emulation-minor-mode-map [right] 'scroll-left) | 78 (define-key w3-netscape-emulation-minor-mode-map [right] 'scroll-left) |
81 (define-key w3-netscape-emulation-minor-mode-map [left] 'scroll-right) | 79 (define-key w3-netscape-emulation-minor-mode-map [left] 'scroll-right) |
82 (define-key w3-netscape-emulation-minor-mode-map [(meta left)] | 80 (define-key w3-netscape-emulation-minor-mode-map [(meta left)] |
83 'w3-history-backward) | 81 'w3-backward-in-history) |
84 (define-key w3-netscape-emulation-minor-mode-map [(meta right)] | 82 (define-key w3-netscape-emulation-minor-mode-map [(meta right)] |
85 'w3-history-forward) | 83 'w3-forward-in-history) |
86 | 84 |
87 (defun turn-on-netscape-emulation () | 85 (defun turn-on-netscape-emulation () |
88 (interactive) | 86 (interactive) |
89 (w3-lynx-emulation-minor-mode 0) | 87 (w3-lynx-emulation-minor-mode 0) |
90 (w3-netscape-emulation-minor-mode 1)) | 88 (w3-netscape-emulation-minor-mode 1)) |
107 | 105 |
108 (defsubst w3-skip-word () | 106 (defsubst w3-skip-word () |
109 (skip-chars-forward "^ \t\n\r") | 107 (skip-chars-forward "^ \t\n\r") |
110 (skip-chars-forward " \t")) | 108 (skip-chars-forward " \t")) |
111 | 109 |
110 (defun w3-read-netscape-config (&optional fname) | |
111 "Read in a netscape-style configuration file." | |
112 (interactive "fNetscape configuration file: ") | |
113 (if (not (and (file-exists-p fname) | |
114 (file-readable-p fname))) | |
115 (error "Could not read %s" fname)) | |
116 (let ((results nil) | |
117 (tag nil) | |
118 (val nil) | |
119 (var nil) | |
120 (save-pos nil)) | |
121 (save-excursion | |
122 (set-buffer (get-buffer-create " *w3-tmp*")) | |
123 (erase-buffer) | |
124 (insert-file-contents-literally fname) | |
125 (goto-char (point-min)) | |
126 (skip-chars-forward "^ \t\r\n") ; Skip tag line | |
127 (skip-chars-forward " \t\r\n") ; Skip blank line(s) | |
128 (while (not (eobp)) | |
129 (setq save-pos (point)) | |
130 (skip-chars-forward "^:") | |
131 (upcase-region save-pos (point)) | |
132 (setq tag (buffer-substring save-pos (point))) | |
133 (skip-chars-forward ":\t ") | |
134 (setq save-pos (point)) | |
135 (skip-chars-forward "^\r\n") | |
136 (setq val (if (= save-pos (point)) | |
137 nil | |
138 (buffer-substring save-pos (point)))) | |
139 (cond | |
140 ((null val) nil) | |
141 ((string-match "^[0-9]+$" val) | |
142 (setq val (string-to-int val))) | |
143 ((string= "false" (downcase val)) | |
144 (setq val nil)) | |
145 ((string= "true" (downcase val)) | |
146 (setq val t)) | |
147 (t nil)) | |
148 (skip-chars-forward " \t\n\r") | |
149 (setq results (cons (cons tag val) results)))) | |
150 (while results | |
151 (setq tag (car (car results)) | |
152 val (cdr (car results)) | |
153 var (cdr-safe (assoc tag w3-netscape-variable-mappings)) | |
154 results (cdr results)) | |
155 (cond | |
156 ((eq var 'w3-delay-image-loads) (set var (not val))) | |
157 (var (set var val)) | |
158 (t nil))))) | |
159 | |
112 | 160 |
113 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 161 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
114 ;; Now, lets try Lynx | 162 ;; Now, lets try Lynx |
115 ;; ------------------ | 163 ;; ------------------ |
116 ;; A few keybindings and modifications to some default functions | 164 ;; A few keybindings and modifications to some default functions |
134 (setq w3-lynx-emulation-minor-mode nil)) | 182 (setq w3-lynx-emulation-minor-mode nil)) |
135 (t | 183 (t |
136 (setq w3-lynx-emulation-minor-mode t | 184 (setq w3-lynx-emulation-minor-mode t |
137 w3-netscape-emulation-minor-mode nil)))) | 185 w3-netscape-emulation-minor-mode nil)))) |
138 | 186 |
139 ;; The list of keybindings for lynx minor mode was compiled from: | |
140 ;; http://www.crl.com/~subir/lynx/lynx_help/keystroke_commands/keystroke_help.htm | |
141 | |
142 ;; Movement | |
143 (define-key w3-lynx-emulation-minor-mode-map [up] 'w3-widget-backward) | |
144 (define-key w3-lynx-emulation-minor-mode-map [down] 'w3-widget-forward) | |
145 (define-key w3-lynx-emulation-minor-mode-map [right] 'w3-follow-link) | |
146 (define-key w3-lynx-emulation-minor-mode-map [left] 'w3-history-backward) | |
147 | |
148 ;; Scrolling | |
149 (define-key w3-lynx-emulation-minor-mode-map "+" 'w3-scroll-up) | 187 (define-key w3-lynx-emulation-minor-mode-map "+" 'w3-scroll-up) |
150 (define-key w3-lynx-emulation-minor-mode-map "-" 'scroll-down) | 188 (define-key w3-lynx-emulation-minor-mode-map "-" 'scroll-down) |
151 (define-key w3-lynx-emulation-minor-mode-map "b" 'scroll-down) | 189 (define-key w3-lynx-emulation-minor-mode-map "b" 'scroll-down) |
152 (define-key w3-lynx-emulation-minor-mode-map "\C-a" 'w3-start-of-document) | 190 (define-key w3-lynx-emulation-minor-mode-map "a" 'w3-hotlist-add-document) |
153 (define-key w3-lynx-emulation-minor-mode-map "\C-e" 'w3-end-of-document) | 191 (define-key w3-lynx-emulation-minor-mode-map "c" 'w3-mail-document-author) |
154 (define-key w3-lynx-emulation-minor-mode-map "\C-f" 'scroll-down) | 192 (define-key w3-lynx-emulation-minor-mode-map "e" 'w3-edit-source) |
155 (define-key w3-lynx-emulation-minor-mode-map "\C-n" 'ignore) ; down 2 | 193 (define-key w3-lynx-emulation-minor-mode-map "g" 'w3-fetch) |
156 (define-key w3-lynx-emulation-minor-mode-map "\C-p" 'ignore) ; up 2 | 194 (define-key w3-lynx-emulation-minor-mode-map "i" 'ignore) |
157 (define-key w3-lynx-emulation-minor-mode-map ")" 'ignore) ; forward half | 195 (define-key w3-lynx-emulation-minor-mode-map "m" 'w3) |
158 (define-key w3-lynx-emulation-minor-mode-map "(" 'ignore) ; back half | 196 (define-key w3-lynx-emulation-minor-mode-map "o" 'ignore) |
159 (define-key w3-lynx-emulation-minor-mode-map "#" 'w3-toggle-toolbar) | 197 (define-key w3-lynx-emulation-minor-mode-map "p" 'w3-print-this-url) |
160 | 198 (define-key w3-lynx-emulation-minor-mode-map "q" 'w3-quit) |
161 ;; Dired bindings don't have any meaning for us | 199 (define-key w3-lynx-emulation-minor-mode-map "/" 'w3-search-forward) |
162 | 200 (define-key w3-lynx-emulation-minor-mode-map "s" 'w3-search-forward) |
163 ;; Other | 201 (define-key w3-lynx-emulation-minor-mode-map "n" 'w3-search-again) |
164 (define-key w3-lynx-emulation-minor-mode-map "?" 'w3-help) | 202 (define-key w3-lynx-emulation-minor-mode-map "v" 'w3-show-hotlist) |
165 (define-key w3-lynx-emulation-minor-mode-map "a" 'w3-hotlist-add-document) | 203 (define-key w3-lynx-emulation-minor-mode-map "=" 'w3-document-information) |
166 (define-key w3-lynx-emulation-minor-mode-map "c" 'w3-mail-document-author) | |
167 (define-key w3-lynx-emulation-minor-mode-map "d" 'w3-download-url) | |
168 (define-key w3-lynx-emulation-minor-mode-map "e" 'ignore) ; edit current | |
169 (define-key w3-lynx-emulation-minor-mode-map "f" 'dired) | |
170 (define-key w3-lynx-emulation-minor-mode-map "g" 'w3-fetch) | |
171 (define-key w3-lynx-emulation-minor-mode-map "h" 'w3-help) | |
172 (define-key w3-lynx-emulation-minor-mode-map "i" 'ignore) | |
173 (define-key w3-lynx-emulation-minor-mode-map "j" 'w3-use-hotlist) | |
174 (define-key w3-lynx-emulation-minor-mode-map "k" 'describe-mode) | |
175 (define-key w3-lynx-emulation-minor-mode-map "l" 'w3-complete-link) | |
176 (define-key w3-lynx-emulation-minor-mode-map "m" 'w3) | |
177 (define-key w3-lynx-emulation-minor-mode-map "n" 'w3-search-again) | |
178 (define-key w3-lynx-emulation-minor-mode-map "o" 'w3-preferences-edit) | |
179 (define-key w3-lynx-emulation-minor-mode-map "p" 'w3-print-this-url) | |
180 (define-key w3-lynx-emulation-minor-mode-map "q" 'w3-quit) | |
181 (define-key w3-lynx-emulation-minor-mode-map "r" 'w3-hotlist-delete) | |
182 (define-key w3-lynx-emulation-minor-mode-map "t" 'ignore) ; tag | |
183 (define-key w3-lynx-emulation-minor-mode-map "u" 'w3-history-backward) | |
184 (define-key w3-lynx-emulation-minor-mode-map "/" 'w3-search-forward) | |
185 (define-key w3-lynx-emulation-minor-mode-map "v" 'w3-show-hotlist) | |
186 (define-key w3-lynx-emulation-minor-mode-map "V" 'w3-show-hotlist) | |
187 (define-key w3-lynx-emulation-minor-mode-map "x" 'w3-follow-link) | |
188 (define-key w3-lynx-emulation-minor-mode-map "z" 'keyboard-quit) | |
189 (define-key w3-lynx-emulation-minor-mode-map "=" 'w3-document-information) | |
190 (define-key w3-lynx-emulation-minor-mode-map "\\" 'w3-source-document) | |
191 (define-key w3-lynx-emulation-minor-mode-map "!" 'shell) | |
192 (define-key w3-lynx-emulation-minor-mode-map "'" 'ignore) ; toggle comment | |
193 (define-key w3-lynx-emulation-minor-mode-map "`" 'ignore) ; toggle comment | |
194 (define-key w3-lynx-emulation-minor-mode-map "*" 'ignore) ; toggle image_links | |
195 (define-key w3-lynx-emulation-minor-mode-map "@" 'ignore) ; toggle raw 8-bit | |
196 (define-key w3-lynx-emulation-minor-mode-map "[" 'ignore) ; pseudo-inlines | |
197 (define-key w3-lynx-emulation-minor-mode-map "]" 'ignore) ; send head | |
198 (define-key w3-lynx-emulation-minor-mode-map "\"" 'ignore) ; toggle quoting | |
199 (define-key w3-lynx-emulation-minor-mode-map "\C-r" 'w3-reload-document) | 204 (define-key w3-lynx-emulation-minor-mode-map "\C-r" 'w3-reload-document) |
200 (define-key w3-lynx-emulation-minor-mode-map "\C-w" 'w3-refresh-buffer) | 205 (define-key w3-lynx-emulation-minor-mode-map "\C-w" 'w3-refresh-buffer) |
201 (define-key w3-lynx-emulation-minor-mode-map "\C-u" 'ignore) ; erase input | 206 (define-key w3-lynx-emulation-minor-mode-map "\\" 'w3-source-document) |
202 (define-key w3-lynx-emulation-minor-mode-map "\C-g" 'keyboard-quit) | 207 (define-key w3-lynx-emulation-minor-mode-map "!" 'shell) |
203 (define-key w3-lynx-emulation-minor-mode-map "\C-t" 'ignore) ; toggle trace | 208 (define-key w3-lynx-emulation-minor-mode-map [up] 'w3-back-link) |
204 (define-key w3-lynx-emulation-minor-mode-map "\C-k" 'ignore) ; cookie jar | 209 (define-key w3-lynx-emulation-minor-mode-map [down] 'w3-forward-link) |
210 (define-key w3-lynx-emulation-minor-mode-map [right] 'w3-follow-link) | |
211 (define-key w3-lynx-emulation-minor-mode-map [left] 'w3-backward-in-history) | |
205 | 212 |
206 (provide 'w3-emulate) | 213 (provide 'w3-emulate) |
207 | 214 |
208 ;;; Local Variables: | 215 ;;; Local Variables: |
209 ;;; truncate-lines: t | 216 ;;; truncate-lines: t |