Initial Commit
[packages] / xemacs-packages / w3 / lisp / w3-vars.el
1 ;;; w3-vars.el,v --- All variable definitions for emacs-w3
2 ;; Author: $Author: fx $
3 ;; Created: $Date: 2001/10/01 11:42:46 $
4 ;; Version: $Revision: 1.8 $
5 ;; Keywords: comm, help, hypermedia
6
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
9 ;;; Copyright (c) 1996, 97, 98, 99, 2001 Free Software Foundation, Inc.
10 ;;;
11 ;;; This file is part of GNU Emacs.
12 ;;;
13 ;;; 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
15 ;;; the Free Software Foundation; either version 2, or (at your option)
16 ;;; any later version.
17 ;;;
18 ;;; GNU Emacs is distributed in the hope that it will be useful,
19 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; 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
25 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;;; Boston, MA 02111-1307, USA.
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28
29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
30 ;;; Variable definitions for w3
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
32
33 (require 'w3-cus)                       ; Grab everything that is customized
34 (require 'wid-edit)                     ; For `widget-keymap'
35
36 (defconst w3-version-number
37   (let ((x "$State: p4.0pre.47 $"))
38     (if (string-match "State:[ \t\n]+\\([^ \t\n]+\\)" x)
39         (setq x (substring x (match-beginning 1) (match-end 1)))
40       (setq x (substring x 1)))
41     (mapconcat
42      (function (lambda (x) (if (= x ?-) "." (char-to-string x)))) x ""))
43   "Version number of w3-mode.")
44
45 (defconst w3-version-date (let ((x "$Date: 2001/10/01 11:42:46 $"))
46                             (if (string-match "Date: \\([^ \t\n]+\\)" x)
47                                 (substring x (match-beginning 1) (match-end 1))
48                               x))
49   "Date this version of w3-mode was released.")
50
51 (defconst w3-version
52   (format "WWW %s %s" w3-version-number w3-version-date)
53   "More descriptive version of w3-version-number.")
54
55 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56 ;;; General configuration variables
57 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
58 (defvar w3-track-last-buffer nil
59   "*Whether to track the last w3 buffer to automatically switch to with
60  M-x w3.")
61
62 (defvar w3-gc-cons-threshold-multiplier 1
63   "Amount to temporarily multiply gc-cons-threshold by when parsing HTML.
64 Setting this to a number greater than 1 will result in less frequent
65 garbage collections when parsing an HTML document, which may often speed
66 up handling of a large document with many elements.  The disadvantage is
67 that it allows Emacs's total memory usage to grow larger, which may result
68 in later garbage collections taking more time.")
69
70 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
71 ;;; Figure out what flavor of emacs we are running
72 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
73 (defvar w3-running-xemacs (string-match "XEmacs" emacs-version)
74   "*Got XEmacs?.")
75
76 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
77 ;; Store the database of HTML general entities.
78 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
79 ;; Commentary on the basis of the current W3C entity list.  -- fx
80 (defvar w3-html-entities 
81   '(
82     ;;(excl        .  33)
83     (quot        .  34)
84     ;;(num         .  35)
85     ;;(dollar      .  36)
86     ;;(percent     .  37)
87     (amp         .  38)
88     (rsquo       .  39)                 ; should be U+8217
89     ;;(apos        .  39)
90     ;;(lpar        .  40)
91     ;;(rpar        .  41)
92     ;;(ast         .  42)
93     ;;(plus        .  43)
94     ;;(comma       .  44)
95     ;;(period      .  46)
96     ;;(colon       .  58)
97     ;;(semi        .  59)
98     (lt          .  60)
99     ;;(equals      .  61)
100     (gt          .  62)
101     ;;(quest       .  63)
102     ;;(commat      .  64)
103     ;;(lsqb        .  91)
104     ;;(rsqb        .  93)
105     (uarr        .  94)                 ; should be U+8593
106     ;;(lowbar      .  95)
107     (lsquo       .  96)                 ; should be U+8216
108     (lcub        . 123)
109     ;;(verbar      . 124)
110     (rcub        . 125)
111     (tilde       . 126)
112     (nbsp        . 160)
113     (iexcl       . 161)
114     (cent        . 162)
115     (pound       . 163)
116     (curren      . 164)
117     (yen         . 165)
118     (brvbar      . 166)
119     (sect        . 167)
120     (uml         . 168)
121     (copy        . 169)
122     (ordf        . 170)
123     (laquo       . 171)
124     (not         . 172)
125     (shy         . 173)
126     (reg         . 174)
127     (macr        . 175)
128     (deg         . 176)
129     (plusmn      . 177)
130     (sup2        . 178)
131     (sup3        . 179)
132     (acute       . 180)
133     (micro       . 181)
134     (para        . 182)
135     (middot      . 183)
136     (cedil       . 184)
137     (sup1        . 185)
138     (ordm        . 186)
139     (raquo       . 187)
140     (frac14      . 188)
141     (frac12      . 189)
142     (frac34      . 190)
143     (iquest      . 191)
144     (Agrave      . 192)
145     (Aacute      . 193)
146     (Acirc       . 194)
147     (Atilde      . 195)
148     (Auml        . 196)
149     (Aring       . 197)
150     (AElig       . 198)
151     (Ccedil      . 199)
152     (Egrave      . 200)
153     (Eacute      . 201)
154     (Ecirc       . 202)
155     (Euml        . 203)
156     (Igrave      . 204)
157     (Iacute      . 205)
158     (Icirc       . 206)
159     (Iuml        . 207)
160     (ETH         . 208)
161     (Ntilde      . 209)
162     (Ograve      . 210)
163     (Oacute      . 211)
164     (Ocirc       . 212)
165     (Otilde      . 213)
166     (Ouml        . 214)
167     (times       . 215)
168     (Oslash      . 216)
169     (Ugrave      . 217)
170     (Uacute      . 218)
171     (Ucirc       . 219)
172     (Uuml        . 220)
173     (Yacute      . 221)
174     (THORN       . 222)
175     (szlig       . 223)
176     (agrave      . 224)
177     (aacute      . 225)
178     (acirc       . 226)
179     (atilde      . 227)
180     (auml        . 228)
181     (aring       . 229)
182     (aelig       . 230)
183     (ccedil      . 231)
184     (egrave      . 232)
185     (eacute      . 233)
186     (ecirc       . 234)
187     (euml        . 235)
188     (igrave      . 236)
189     (iacute      . 237)
190     (icirc       . 238)
191     (iuml        . 239)
192     (eth         . 240)
193     (ntilde      . 241)
194     (ograve      . 242)
195     (oacute      . 243)
196     (ocirc       . 244)
197     (otilde      . 245)
198     (ouml        . 246)
199     (divide      . 247)
200     (oslash      . 248)
201     (ugrave      . 249)
202     (uacute      . 250)
203     (ucirc       . 251)
204     (uuml        . 252)
205     (yacute      . 253)
206     (thorn       . 254)
207     (yuml        . 255)
208
209     ;; Special handling of these
210     (frac56      . "5/6")
211     (frac16      . "1/6")
212     (frac45      . "4/5")
213     (frac35      . "3/5")
214     (frac25      . "2/5")
215     (frac15      . "1/5")
216     (frac23      . "2/3")
217     (frac13      . "1/3")
218     (frac78      . "7/8")
219     (frac58      . "5/8")
220     (frac38      . "3/8")
221     (frac18      . "1/8")
222     
223     ;; The following 5 entities are not mentioned in the HTML 2.0
224     ;; standard, nor in any other HTML proposed standard of which I
225     ;; am aware.  I am not even sure they are ISO entity names.  ***
226     ;; Hence, some arrangement should be made to give a bad HTML
227     ;; message when they are seen.
228     (ndash       .  45)
229     (mdash       .  45)
230     (emsp        .  32)
231     (ensp        .  32)
232     (sim         . 126)
233     (le          . "<=")
234     (agr         . "alpha")
235     (rdquo       . "''")
236     (ldquo       . "``")
237     (trade       . "(TM)")
238     ;; To be done
239     ;; (shy      . ????) ; soft hyphen
240     )
241   "*An assoc list of entity names and how to actually display them.")
242
243 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
244 ;;; Menu definitions
245 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
246 (defvar w3-popup-menu
247   '("Emacs-W3 Commands"
248     ["Back" w3-history-backward (car (w3-history-find-url-internal (url-view-url t)))]
249     ["Forward" w3-history-forward (cdr (w3-history-find-url-internal (url-view-url t)))]
250     "---"
251     ["Reload"       (w3-reload-document) t]
252     ["Show Images"  (w3-load-delayed-images) w3-delayed-images]
253     "---"
254     ["Add bookmark" (w3-hotlist-add-document nil) t]
255     )
256   "The shorter popup menu.")
257
258 (defvar w3-graphlink-menu
259   '(("Open this Image (%s)"     . w3-fetch)
260     ("Save this Image As..."    . w3-download-url)
261     ("Copy this Image Location" . w3-save-url))
262   "An assoc list of function names and labels.  These will be displayed
263 in a popup menu when the mouse is pressed on a hyperlink.  Format is
264 \( (label . function)), function is called with one argument, the URL of
265 the link.  Each label can have exactly one `%s' that will be replaced by
266 the URL of the link.")
267
268 (defvar w3-hyperlink-menu
269   '(("Open this Link (%s)"        . w3-fetch)
270     ("Add Bookmark for this Link" . w3-hotlist-add-document-at-point)
271     ("New Window with this Link"  . w3-fetch-other-frame)
272     ("Save Link As..."            . w3-download-url)
273     ("Copy this Link Location to Clipboard" . w3-save-url))
274   "An assoc list of function names and labels.  These will be displayed
275 in a popup menu when the mouse is pressed on a hyperlink.  Format is
276 \( (label . function)), function is called with one argument, the URL of
277 the link.  Each label can have exactly one `%s' that will be replaced by
278 the URL of the link.")
279
280 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
281 ;;; Variables internal to W3, you should not change any of these
282 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
283 (defvar w3-graphics-list nil
284   "List of graphics already read in.")
285
286 (defvar w3-delayed-images nil
287   "A buffer-local variable holding positions and urls of images within
288 the buffer.")
289
290 (defvar w3-frameset-structure nil
291   "Frameset structure, heap of '(frameset ({cols|rows} \"<dimensions>\")) and '(<frame name> <href>)")
292
293 (defvar w3-frame-name nil
294   "Frame name")
295
296 (defvar w3-base-target nil
297   "Base target name")
298
299 (defvar w3-target-window-distances nil
300   "Target window distances")
301
302 (defvar w3-tty-char-width 8
303   "*Char width to use when in a tty")
304
305 (defvar w3-tty-char-height 15
306   "*Char height to use when in a tty")
307
308 (defvar w3-form-radio-elements nil "Internal variable - do not touch!")
309 (defvar w3-form-elements nil "Internal variable - do not touch!")
310
311 (defvar w3-user-stylesheet nil
312   "The global stylesheet for this user.")
313
314 (defvar w3-current-stylesheet nil
315   "The stylesheet for this document.")
316
317 (defvar w3-last-fill-pos nil
318   "An internal variable for the new display engine that specifies the
319 last character position that was correctly filled.")
320
321 (defvar w3-active-faces nil "The list of active faces.")
322 (defvar w3-active-voices nil "The list of active voices.")
323
324 (defconst w3-bug-address "w3-bugs@xemacs.org"
325   "Address of current maintainer, where to send bug reports.")
326 (defvar w3-current-isindex nil "Is the current document a searchable index?")
327 (defvar w3-current-buffer nil "Is the current W3 buffer")
328 (defvar w3-current-last-buffer nil "Last W3 buffer seen before this one.")
329 (defvar w3-current-links nil "An assoc list of <link> tags for this doc.")
330 (defvar w3-current-metainfo nil "An assoc list of <meta> tags for this doc.")
331 (defvar w3-current-source nil "Source of current document.")
332 (defvar w3-current-parse nil "Parsed version of current document.")
333 (defvar w3-current-badhtml nil "List of HTML warnings for this page.")
334 (defvar w3-find-this-link nil "Link to go to within a document.")
335 (defvar w3-hidden-forms nil "List of hidden form areas and their info.")
336 (defvar w3-hotlist nil "Default hotlist.")
337 (defvar w3-last-buffer nil "The last W3 buffer visited.")
338 (defvar w3-roman-characters "ivxLCDMVX" "Roman numerals.")
339 (defvar w3-setup-done nil "Have we been through setup code yet?")
340
341 (defvar w3-strict-width nil
342   "*This variable will control how wide emacs thinks the current window is.
343 This is useful when working in batch mode, and (window-width) returns the
344 wrong value.  If the value is nil, it will use the value (window-width)
345 returns.")
346
347 (defvar w3-submit-button nil
348   "A widget object specifying what button was pressed to submit a form.")
349
350 (defvar w3-explicit-conversion-tree nil
351   "Tree to hold explicit coding systems for URLs and their superdirs:
352    ((hostN default-coding (dirN-1 default-coding (dirN-1-1 ...) ...) ...)
353     ...)")
354
355 (defvar w3-explicit-encodings-changed-since-last-save nil
356   "Whether the explicit encodings tree has changed since the last save operation.")
357
358 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
359 ;;; buffer-local variables to keep around when going into w3-mode
360 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
361 (defvar w3-id-positions nil "Internal use only.")
362 (defvar w3-imagemaps nil "Internal use only.")
363
364 ;; Why aren't these just permanent-local?  -- fx
365 (defvar w3-persistent-variables
366   '(
367     ;; So we can show the URL in the list-buffers listing
368     list-buffers-directory
369     ;; So widgets don't get lost
370     widget-field-new
371     w3-form-radio-elements
372     w3-form-elements
373     url-current-object
374     w3-current-badhtml
375     w3-current-parse
376     w3-current-isindex
377     w3-current-last-buffer
378     w3-current-links
379     w3-current-metainfo
380     w3-current-source
381     w3-delayed-images
382     w3-hidden-forms
383     w3-current-stylesheet
384     w3-form-labels
385     w3-id-positions
386     w3-imagemaps
387     w3-base-target
388     w3-target-window-distances
389     w3-frameset-structure
390     buffer-file-coding-system
391     url-current-mime-headers
392     )
393   "A list of variables that should be preserved when entering w3-mode.")
394
395 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
396 ;;; Emulation stuff
397 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
398 (defvar w3-netscape-emulation-minor-mode nil
399   "Whether we are in the netscape emulation minor mode.")
400 (defvar w3-netscape-emulation-minor-mode-map (make-sparse-keymap)
401   "Keymap for netscape emulation.")
402 (defvar w3-lynx-emulation-minor-mode nil
403   "Whether we are in the lynx emulation minor mode.")
404 (defvar w3-lynx-emulation-minor-mode-map (make-sparse-keymap)
405   "Keymap for lynx emulation.")
406 (defvar w3-last-search-item nil)
407
408 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
409 ;;; Startup items
410 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
411 (defvar w3-form-labels nil "")
412 (mapc (function
413        (lambda (var)
414          (if (boundp var)
415              (make-variable-buffer-local var)))) w3-persistent-variables)
416
417 (make-variable-buffer-local 'w3-last-fill-pos)
418 (make-variable-buffer-local 'w3-frame-name)
419 (make-variable-buffer-local 'w3-active-faces)
420 (make-variable-buffer-local 'w3-netscape-emulation-minor-mode)
421 (make-variable-buffer-local 'w3-lynx-emulation-minor-mode)
422 (make-variable-buffer-local 'w3-last-search-item)
423
424 (defvar w3-table-structure nil
425   "Structure to hold table info")
426 (make-variable-buffer-local 'w3-table-structure)
427 \f
428 (require 'w3-keymap)
429 (provide 'w3-vars)