annotate lisp/w3/w3-emulate.el @ 98:0d2f883870bc r20-1b1

Import from CVS: tag r20-1b1
author cvs
date Mon, 13 Aug 2007 09:13:56 +0200
parents 6a378aca36af
children fe104dbd9147
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1 ;;; w3-emulate.el --- All variable definitions for emacs-w3
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Author: wmperry
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
3 ;; Created: 1997/02/04 19:21:18
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
4 ;; Version: 1.11
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: comm, help, hypermedia
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
11 ;;; This file is part of GNU Emacs.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;; You should have received a copy of the GNU General Public License
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
24 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
25 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
26 ;;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; Provide emulations of various other web browsers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (require 'w3-vars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; First, we emulate Netscape 2.x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; ------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; This entails mainly a few new keybindings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;; Alt-S == Save As
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; Alt-M == New Mail Message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; Alt-N == New Window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; Alt-L == Open Location
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; Alt-O == Open File
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;; Alt-P == Print
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; Alt-Q == Quit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;; Alt-F == Search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;; Alt-G == Search Again
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; Alt-R == Reload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;; Alt-I == Load Images
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;; Alt-A == Add Bookmark
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;; Alt-B == Show Bookmark Window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;; Alt-H == Show History Window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;; Alt-Left == Back
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;; Alt-Right== Forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;; Right == Scroll left
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;; Left == Scroll right
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;; Up == Smooth scroll up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;; Down == Smooth scroll down
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (define-key w3-netscape-emulation-minor-mode-map "\M-s" 'w3-save-as)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (define-key w3-netscape-emulation-minor-mode-map "\M-m" 'w3-mailto)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (define-key w3-netscape-emulation-minor-mode-map "\M-n" 'make-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (define-key w3-netscape-emulation-minor-mode-map "\M-l" 'w3-fetch)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (define-key w3-netscape-emulation-minor-mode-map "\M-o" 'w3-open-local)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (define-key w3-netscape-emulation-minor-mode-map "\M-p" 'w3-print-this-url)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (define-key w3-netscape-emulation-minor-mode-map "\M-q" 'w3-quit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (define-key w3-netscape-emulation-minor-mode-map "\M-f" 'w3-search-forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (define-key w3-netscape-emulation-minor-mode-map "\M-g" 'w3-search-again)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (define-key w3-netscape-emulation-minor-mode-map "\M-r" 'w3-reload-document)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (define-key w3-netscape-emulation-minor-mode-map "\M-i" 'w3-load-delayed-images)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (define-key w3-netscape-emulation-minor-mode-map "\M-a" 'w3-hotlist-add-document)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (define-key w3-netscape-emulation-minor-mode-map "\M-b" 'w3-show-hotlist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (define-key w3-netscape-emulation-minor-mode-map "\M-h" 'w3-show-history-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (define-key w3-netscape-emulation-minor-mode-map [up]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (function (lambda () (interactive) (scroll-down 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (define-key w3-netscape-emulation-minor-mode-map [down]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (function (lambda () (interactive) (scroll-up 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (define-key w3-netscape-emulation-minor-mode-map [right] 'scroll-left)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (define-key w3-netscape-emulation-minor-mode-map [left] 'scroll-right)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (define-key w3-netscape-emulation-minor-mode-map [(meta left)]
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
83 'w3-history-backward)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (define-key w3-netscape-emulation-minor-mode-map [(meta right)]
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
85 'w3-history-forward)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (defun turn-on-netscape-emulation ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (w3-lynx-emulation-minor-mode 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (w3-netscape-emulation-minor-mode 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (defun w3-netscape-emulation-minor-mode (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 "Minor mode for emulating netscape key navigation."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ((null arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (setq w3-netscape-emulation-minor-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (not w3-netscape-emulation-minor-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (if w3-netscape-emulation-minor-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (setq w3-lynx-emulation-minor-mode nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 ((= 0 arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (setq w3-netscape-emulation-minor-mode nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (setq w3-lynx-emulation-minor-mode nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 w3-netscape-emulation-minor-mode t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (defsubst w3-skip-word ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (skip-chars-forward "^ \t\n\r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (skip-chars-forward " \t"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
112 (defun w3-read-netscape-config (&optional fname)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
113 "Read in a netscape-style configuration file."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
114 (interactive "fNetscape configuration file: ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
115 (if (not (and (file-exists-p fname)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
116 (file-readable-p fname)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
117 (error "Could not read %s" fname))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
118 (let ((results nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
119 (tag nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
120 (val nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
121 (var nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
122 (save-pos nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
123 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
124 (set-buffer (get-buffer-create " *w3-tmp*"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
125 (erase-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
126 (insert-file-contents-literally fname)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
127 (goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
128 (skip-chars-forward "^ \t\r\n") ; Skip tag line
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
129 (skip-chars-forward " \t\r\n") ; Skip blank line(s)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
130 (while (not (eobp))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
131 (setq save-pos (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
132 (skip-chars-forward "^:")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
133 (upcase-region save-pos (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
134 (setq tag (buffer-substring save-pos (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
135 (skip-chars-forward ":\t ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
136 (setq save-pos (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
137 (skip-chars-forward "^\r\n")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
138 (setq val (if (= save-pos (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
139 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
140 (buffer-substring save-pos (point))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
141 (cond
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
142 ((null val) nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
143 ((string-match "^[0-9]+$" val)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
144 (setq val (string-to-int val)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
145 ((string= "false" (downcase val))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
146 (setq val nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
147 ((string= "true" (downcase val))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
148 (setq val t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
149 (t nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
150 (skip-chars-forward " \t\n\r")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
151 (setq results (cons (cons tag val) results))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
152 (while results
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
153 (setq tag (car (car results))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
154 val (cdr (car results))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
155 var (cdr-safe (assoc tag w3-netscape-variable-mappings))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
156 results (cdr results))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
157 (cond
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
158 ((eq var 'w3-delay-image-loads) (set var (not val)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
159 (var (set var val))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
160 (t nil)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
161
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ;; Now, lets try Lynx
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ;; ------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;; A few keybindings and modifications to some default functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (defun turn-on-lynx-emulation ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (w3-netscape-emulation-minor-mode 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (w3-lynx-emulation-minor-mode 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (defun w3-lynx-emulation-minor-mode (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 "Minor mode for emulating lynx key navigation."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ((null arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (setq w3-lynx-emulation-minor-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (not w3-lynx-emulation-minor-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (if w3-lynx-emulation-minor-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (setq w3-netscape-emulation-minor-mode nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ((= 0 arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (setq w3-lynx-emulation-minor-mode nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (setq w3-lynx-emulation-minor-mode t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 w3-netscape-emulation-minor-mode nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
189 ;; The list of keybindings for lynx minor mode was compiled from:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
190 ;; http://www.crl.com/~subir/lynx/lynx_help/keystroke_commands/keystroke_help.htm
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
191
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
192 ;; Movement
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
193 (define-key w3-lynx-emulation-minor-mode-map [up] 'w3-widget-backward)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
194 (define-key w3-lynx-emulation-minor-mode-map [down] 'w3-widget-forward)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
195 (define-key w3-lynx-emulation-minor-mode-map [right] 'w3-follow-link)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
196 (define-key w3-lynx-emulation-minor-mode-map [left] 'w3-history-backward)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
197
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
198 ;; Scrolling
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (define-key w3-lynx-emulation-minor-mode-map "+" 'w3-scroll-up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (define-key w3-lynx-emulation-minor-mode-map "-" 'scroll-down)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (define-key w3-lynx-emulation-minor-mode-map "b" 'scroll-down)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
202 (define-key w3-lynx-emulation-minor-mode-map "\C-a" 'w3-start-of-document)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
203 (define-key w3-lynx-emulation-minor-mode-map "\C-e" 'w3-end-of-document)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
204 (define-key w3-lynx-emulation-minor-mode-map "\C-f" 'scroll-down)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
205 (define-key w3-lynx-emulation-minor-mode-map "\C-n" 'ignore) ; down 2
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
206 (define-key w3-lynx-emulation-minor-mode-map "\C-p" 'ignore) ; up 2
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
207 (define-key w3-lynx-emulation-minor-mode-map ")" 'ignore) ; forward half
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
208 (define-key w3-lynx-emulation-minor-mode-map "(" 'ignore) ; back half
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
209 (define-key w3-lynx-emulation-minor-mode-map "#" 'w3-toggle-toolbar)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
210
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
211 ;; Dired bindings don't have any meaning for us
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
212
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
213 ;; Other
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
214 (define-key w3-lynx-emulation-minor-mode-map "?" 'w3-help)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
215 (define-key w3-lynx-emulation-minor-mode-map "a" 'w3-hotlist-add-document)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
216 (define-key w3-lynx-emulation-minor-mode-map "c" 'w3-mail-document-author)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
217 (define-key w3-lynx-emulation-minor-mode-map "d" 'w3-download-url)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
218 (define-key w3-lynx-emulation-minor-mode-map "e" 'ignore) ; edit current
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
219 (define-key w3-lynx-emulation-minor-mode-map "f" 'dired)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
220 (define-key w3-lynx-emulation-minor-mode-map "g" 'w3-fetch)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
221 (define-key w3-lynx-emulation-minor-mode-map "h" 'w3-help)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
222 (define-key w3-lynx-emulation-minor-mode-map "i" 'ignore)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
223 (define-key w3-lynx-emulation-minor-mode-map "j" 'w3-use-hotlist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
224 (define-key w3-lynx-emulation-minor-mode-map "k" 'describe-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
225 (define-key w3-lynx-emulation-minor-mode-map "l" 'w3-complete-link)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
226 (define-key w3-lynx-emulation-minor-mode-map "m" 'w3)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
227 (define-key w3-lynx-emulation-minor-mode-map "n" 'w3-search-again)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
228 (define-key w3-lynx-emulation-minor-mode-map "o" 'w3-preferences-edit)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
229 (define-key w3-lynx-emulation-minor-mode-map "p" 'w3-print-this-url)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
230 (define-key w3-lynx-emulation-minor-mode-map "q" 'w3-quit)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
231 (define-key w3-lynx-emulation-minor-mode-map "r" 'w3-hotlist-delete)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
232 (define-key w3-lynx-emulation-minor-mode-map "t" 'ignore) ; tag
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
233 (define-key w3-lynx-emulation-minor-mode-map "u" 'w3-history-backward)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
234 (define-key w3-lynx-emulation-minor-mode-map "/" 'w3-search-forward)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
235 (define-key w3-lynx-emulation-minor-mode-map "v" 'w3-show-hotlist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
236 (define-key w3-lynx-emulation-minor-mode-map "V" 'w3-show-hotlist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
237 (define-key w3-lynx-emulation-minor-mode-map "x" 'w3-follow-link)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
238 (define-key w3-lynx-emulation-minor-mode-map "z" 'keyboard-quit)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
239 (define-key w3-lynx-emulation-minor-mode-map "=" 'w3-document-information)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
240 (define-key w3-lynx-emulation-minor-mode-map "\\" 'w3-source-document)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
241 (define-key w3-lynx-emulation-minor-mode-map "!" 'shell)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
242 (define-key w3-lynx-emulation-minor-mode-map "'" 'ignore) ; toggle comment
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
243 (define-key w3-lynx-emulation-minor-mode-map "`" 'ignore) ; toggle comment
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
244 (define-key w3-lynx-emulation-minor-mode-map "*" 'ignore) ; toggle image_links
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
245 (define-key w3-lynx-emulation-minor-mode-map "@" 'ignore) ; toggle raw 8-bit
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
246 (define-key w3-lynx-emulation-minor-mode-map "[" 'ignore) ; pseudo-inlines
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
247 (define-key w3-lynx-emulation-minor-mode-map "]" 'ignore) ; send head
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
248 (define-key w3-lynx-emulation-minor-mode-map "\"" 'ignore) ; toggle quoting
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (define-key w3-lynx-emulation-minor-mode-map "\C-r" 'w3-reload-document)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (define-key w3-lynx-emulation-minor-mode-map "\C-w" 'w3-refresh-buffer)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
251 (define-key w3-lynx-emulation-minor-mode-map "\C-u" 'ignore) ; erase input
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
252 (define-key w3-lynx-emulation-minor-mode-map "\C-g" 'keyboard-quit)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
253 (define-key w3-lynx-emulation-minor-mode-map "\C-t" 'ignore) ; toggle trace
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
254 (define-key w3-lynx-emulation-minor-mode-map "\C-k" 'ignore) ; cookie jar
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (provide 'w3-emulate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 ;;; Local Variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 ;;; truncate-lines: t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 ;;; End: