1 ;;; w3-cus.el --- Customization support for Emacs-W3
2 ;; Author: $Author: fx $
3 ;; Created: $Date: 2001/10/11 12:59:46 $
4 ;; Version: $Revision: 1.9 $
5 ;; Keywords: comm, help, hypermedia
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
9 ;;; Copyright (c) 1996 - 1999 Free Software Foundation, Inc.
11 ;;; This file is part of GNU Emacs.
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.
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.
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29 (defgroup w3 '((url custom-group))
30 "Emacs-W3 - the web browser of choice."
33 (defgroup w3-files nil
34 "Emacs-W3 configuration files."
38 (defgroup w3-images nil
39 "Controlling image handling."
43 (defgroup w3-printing nil
44 "Various options for hardcopy from web pages."
48 (defgroup w3-menus nil
49 "The look of menus in Emacs-W3"
53 (defgroup w3-parsing nil
54 "Options relating to HTML parsing"
58 (defgroup w3-display nil
59 "Variables relating to how web pages are displayed."
63 (defgroup w3-hooks nil
64 "Hooks relating to Emacs-W3."
68 ;;; File related variables
69 (defcustom w3-configuration-directory "~/.w3/"
70 "Directory where Emacs-w3 can find its configuration files."
74 (defcustom w3-default-configuration-file "profile"
75 "Base filename where per-user customizations are kept.
76 This filename is relative to `w3-configuration-directory' if
81 (defcustom w3-default-homepage nil
82 "The url to open at startup. It can be any valid URL.
83 This will default to the environment variable WWW_HOME if you do not
84 set it in your .emacs file. If WWW_HOME is undefined, then it will
85 default to the hypertext documentation for W3 at Indiana University."
89 (defcustom w3-default-stylesheet nil
90 "The filename of the users default stylesheet."
92 :type '(choice (const :tag "None" :value nil)
95 (defcustom w3-hotlist-file nil
97 This should be the name of a file that is stored in either
98 NCSA's Mosaic/X or Netscape/X format. It is used to keep a listing
99 of commonly accessed URL's without having to go through 20 levels of
100 menus to get to them."
104 (defcustom w3-explicit-encodings-file nil
105 "Explicit encodings filename.
106 This should be the name of a file that is used to keep user-specified
107 explicit encodings for URLs."
111 (defcustom w3-documentation-root "http://www.cs.indiana.edu/elisp/w3/"
112 "Where the w3 documentation lives. This MUST end in a slash."
116 ;;; Display related variables
117 (defcustom w3-display-frames t
118 "*Fetch frames - can be:
119 nil no frame display whatsoever
120 'as-links display frame hyperlinks, but do not fetch them
121 'ask display frame hyperlinks and ask whether to fetch them
122 t display frame hyperlinks and fetch them."
124 :type '(choice (const :tag "Do not display frames" :value nil)
125 (const :tag "Show hyperlinks" :value as-links)
126 (const :tag "Show hyperlinks, ask whether to retrieve them" :value ask)
127 (const :tag "Automatically retrieve frames" :value t)))
129 (defcustom w3-bullets
135 "An alist of unordered list types.
136 This maps to characters to use as the bullet character."
138 :type '(repeat (cons :format "%v"
140 (character :tag "Character"))))
142 (defcustom w3-echo-link '(title url text name)
143 "*Whether to display the URL of a link when tabbing through links.
144 Value is a list of one or more of the following symbols:
146 url == url of the target
147 text == text of the link
148 title == title attribute of the link
149 name == name or id attribute of the link
151 If none of the information is available, nothing will be shown for the link
154 :type '(set (const :tag "URL" :value url)
155 (const :tag "Link Text" :value text)
156 (const :tag "Title of the link as defined in the HTML tag"
158 (const :tag "Name of the link as defined in the HTML tag"
161 (defcustom w3-horizontal-rule-char nil
162 "The character to use to create a horizontal rule.
163 Must be the character's code, not a string. This character is
164 replicated across the screen to create a division.
165 If nil W3 will use a terminal graphic character if possible."
167 :type '(choice (const :tag "Best possible" :value nil)
170 (defcustom w3-force-conversion-alist nil
171 "*An alist of URL host/filename regexps and coding systems to use for them."
173 :type `(repeat (cons (string :tag "Host / filename")
174 ;; Fixme: Emacs 21 has coding-system :type.
175 (symbol :tag "Coding system" :value binary))))
177 ;;; these four variables control how w3-setup-terminal-chars works
178 (defcustom w3-use-terminal-characters nil
179 "*Use terminal graphics characters for drawing tables and rules if available."
183 (defcustom w3-use-terminal-characters-on-tty nil
184 "*Use terminal graphics characters for tables and rules even on a tty.
185 This triggers display bugs on both Emacs and XEmacs.
186 \(Though it's usually tolerable at least in Emacs.)"
190 (defcustom w3-use-terminal-glyphs nil
191 "*Use glyphs if possible rather than properties for terminal graphics characters.
193 Glyphs are probably more efficient but don't work with the most recent versions
194 of XEmacs and there are some cute tricks we can play with text-properties that
195 glyphs won't let us do. It may be possible someday to make XEmacs automagically
196 translate the characters back to ascii characters when pasted into another
197 buffer. (On the other hand, right now `w3-excise-terminal-characters' doesn't
198 work at all if we're using text-properties)."
200 :type '(choice (const :tag "Use Glyphs" :value t)
201 (const :tag "Use Text Properties" :value nil)))
203 (defcustom w3-use-unicode-table-characters nil
204 "*Non-nil means use Unicode box-drawing characters for tables if avilable.
205 This only works for Emacs 21. You might wat to turn this off if your
206 Unicode font isn't available in appropriate sizes."
210 (defcustom w3-do-incremental-display nil
211 "*Non-nil means do incremental display of pages."
215 (defcustom w3-defined-link-types
216 ;; This is the HTML3.0 list (downcased) plus "made".
217 '("previous" "next" "up" "down" "home" "toc" "index" "glossary"
218 "copyright" "bookmark" "help" "made" "contents" "top")
220 ;; <URL:http://www.w3.org/TR/html401/types.html#type-links>:
221 ;; Alternate, Stylesheet, Start, Next, Prev, Contents, Index,
222 ;; Glossary, Copyright, Chapter, Section, Subsection, Appendix,
224 "A list of the (lower-case) names which have special significance.
225 The significance is when they are used as the values of REL or REV
226 attributes of <link> elements. They will be presented on the toolbar
227 or the links menu, for instance."
229 :type '(repeat string))
231 ;;; Parsing related variables
232 (defcustom w3-debug-html nil
233 "*Non-nil means to gripe about bad HTML."
235 :type '(choice (const :tag "HTML Errors" :value t)
236 (const :tag "Errors and stylistic issues" :value style)
237 (const :tag "None" :value nil)))
239 (defcustom w3-debug-buffer "*HTML Debug*"
240 "Name of buffer to store debugging information in."
244 ;;; Image related variables
245 (defcustom w3-auto-image-alt 'w3-default-image-alt-func
246 "*Whether to create an alt attribute for an image that is missing it.
247 If nil, Emacs-W3 will not automatically create an ALT attribute.
249 If a string, it should be a string suitable for running through format,
250 with only one %s, which will be replaced with just the filename of the
251 graphic that is not loaded.
253 Otherwise, it is considered a function and is passed a single
254 argument, the filename of the graphic that is not loaded."
256 :type '(choice (const :tag "None" :value nil)
257 (const :tag "Default" :value "[IMAGE(%s)]")
258 (string :tag "Format string")
259 (sexp :tag "Function" :value nil)))
261 (defcustom w3-delay-image-loads (not (or (and (fboundp 'display-images-p)
267 "*Non-nil means delay loading images, not automatically retrieve them."
271 (defcustom w3-image-mappings
273 ("image/x-xbitmap" . xbm)
274 ("image/xbitmap" . xbm)
276 ("image/jpeg" . jpeg)
279 ("image/x-fax" . g3fax)
280 ("image/x-raster" . rast)
281 ("image/windowdump" . xwd)
282 ("image/x-icon" . icon)
283 ("image/portable-graymap" . pgm)
284 ("image/portable-pixmap" . ppm)
285 ("image/x-pixmap" . xpm)
286 ("image/x-xpixmap" . xpm)
287 ("image/pict" . pict)
288 ("image/x-rgb" . sgi)
289 ("image/x-sgi" . sgi)
290 ("image/x-macpaint" . macpt)
291 ("image/x-targa" . tga)
292 ("image/tiff" . tiff)
294 "How to map MIME types to image types for the `image' package.
295 Each entry is a cons cell of MIME types and image-type symbols."
297 :type '(repeat (cons :format "%v"
298 (string :tag "MIME Type")
299 (symbol :tag "Image type"))))
302 (defcustom w3-max-menu-length 35
303 "The maximum length of a pulldown menu.
304 This is the length before it will be split into smaller chunks, with
305 the first part as a submenu, followed by the rest of the menu."
309 (defcustom w3-max-menu-width 40
310 "*The maximum width of a pulldown menu choice."
315 (defcustom w3-modeline-format
317 (w3-netscape-emulation-minor-mode
319 (w3-lynx-emulation-minor-mode
324 (w3-current-isindex "[Searchable] ")
325 (w3-current-badhtml "[BAD HTML] ")
326 "%p" " " global-mode-string))
327 "The modeline format string when in w3 mode."
331 (defcustom w3-netscape-compatible-comments nil
332 "*Whether to honor netscape-style <! > comments."
336 (defcustom w3-notify 'semibully
337 "*Selects the behavior when w3 page is ready.
338 This variable may have one of the following values:
340 newframe -- put the w3 page in its own frame
341 bully -- make the w3 page the current buffer and only window
342 semibully -- make the w3 page the current buffer in the same window
343 aggressive -- make the w3 page the current buffer in the other window
344 friendly -- display w3page in other window but don't make current
345 polite -- don't display w3 page, but prints message when ready (beeps)
346 quiet -- like `polite', but don't beep
347 meek -- make no indication that page is ready
349 Any other value of `w3-notify' is equivalent to `meek'."
351 :type '(choice (const :tag "Display in a new frame"
353 (const :tag "Display in the current window, select buffer, and kill other windows"
355 (const :tag "Display in the current window, select buffer"
357 (const :tag "Display in another window, select buffer"
359 (const :tag "Display in another window, but do not select it"
361 (const :tag "Do not display page, but show a message and beep"
363 (const :tag "Do not display page, but show a message (no beep)"
365 (const :tag "Do not indicate that the page has been retrieved"
368 (defcustom w3-popup-menu-on-mouse-3 t
369 "*Non-nil value means W3 should provide context-sensitive menus on mouse-3.
370 A nil value means W3 should not change the binding of mouse-3."
374 (defcustom w3-reuse-buffers 'yes
375 "What to do when following a link will re-fetch a document.
376 This means a document that has already been fetched into a W3 buffer.
377 Possible values are: nil, `yes', and `no'. Nil means ask the user if
378 we should reuse the buffer. A value of 'yes means assume the user
379 wants us to reuse the buffer. A value of 'no means assume the user
380 wants us to re-fetch the document.
382 This will also accept:
383 'no ==> always reload
384 'yes ==> always reuse
387 :type '(choice (const :tag "Always reload" :value no)
388 (const :tag "Always reuse" :value yes)
389 (const :tag "Always ask" :value ask)))
391 (defcustom w3-right-margin 2
392 "*Default right margin for Emacs-W3 buffers.
393 This amount is subtracted from (window-width) for each new WWW buffer
394 and used as the new fill column."
398 (defcustom w3-maximum-line-length nil
399 "*Maximum length of a line.
400 If nil, then lines can extend all the way to the window margin."
402 :type '(radio (const :tag "Use all available space" :value nil)
403 (integer :tag "Limit to")))
405 (defcustom w3-track-mouse t
406 "*Non-nil means track the mouse and message the url under the mouse."
410 (defcustom w3-honor-stylesheets nil
411 "*Whether to let a document specify a CSS stylesheet."
415 (defcustom w3-user-colors-take-precedence nil
416 "*Non-nil means don't let a document define certain colors itself.
417 Like foreground and background colors and pixmaps, color of links and
422 (defcustom w3-user-fonts-take-precedence nil
423 "*Non-nil means don't let a document define certain fonts.
424 Certain fonts can cause problems under Emacs."
429 (defcustom w3-load-hook nil
430 "Hook run after loading w3."
434 (defcustom w3-mode-hook nil
435 "Hook run after entering W3 mode."
439 (defcustom w3-source-file-hook nil
440 "Hook run after getting document source."
444 (defcustom w3-display-errors-hook nil
445 "Hook run after displaying HTML errors for a page."
449 (defcustom w3-html-errors-font-lock-keywords
450 '(("\\(HTML errors for\\) \\(.*\\)"
451 (1 font-lock-function-name-face) (2 font-lock-reference-face))
452 ("Empty \\([A-Z0-9]+\\) element." (1 font-lock-type-face))
453 ("Bad attribute name syntax: \\(.*\\)" (1 font-lock-type-face))
454 ("Bad attribute value syntax: \\(.*\\)" (1 font-lock-type-face))
455 ("Evil attribute value syntax: \\(.*\\)" (1 font-lock-type-face))
456 ("Attribute value missing end quote: \\(.*\\)" (1 font-lock-type-face))
457 ("Bad start-tag \\([A-Z0-9]+\\)" (1 font-lock-type-face))
458 ("\\([A-Z0-9]+\\) element has no \\([A-Z0-9]+\\) attribute"
459 (1 font-lock-type-face) (2 font-lock-type-face))
460 (", inferring \\(</?[A-Z0-9]+>\\)" (1 font-lock-type-face))
461 ("Bad unclosed \\([A-Z0-9]+\\) tag" (1 font-lock-type-face))
462 ("Bad comment (unterminated or unbalanced \"\\(--\\)\" pairs)" (1 font-lock-type-face t))
463 ("Obsolete element \\(.*\\)" (1 font-lock-type-face))
464 ("Deprecated element \\(.*\\)" (1 font-lock-type-face))
465 ("\\[deprecated inside \\([A-Z0-9]+\\)\\]" (1 font-lock-type-face))
466 ("\\(</[A-Z0-9]+>\\) end-tag not omissible (required due to \\(</?[A-Z0-9]+>\\) end-tag)"
467 (1 font-lock-type-face) (2 font-lock-type-face))
468 ("Bad data characters [\\([^][]\\)], " (1 font-lock-comment-face))
469 ("Bad \\(<!\\) syntax." (1 font-lock-type-face))
470 ("Unterminated IGNORE marked section.")
471 ("Invalid SGML character: \\(.\\)" (1 font-lock-type-face))
472 ("Unmatched end-tag \\(</[A-Z0-9]+>\\)" (1 font-lock-type-face))
473 ;;("</?[A-Z0-9]+>" . font-lock-type-face)
474 ("^ [A-Z][a-zA-Z0-9 ]*: .*" . font-lock-comment-face)
475 ("^ [A-Z][a-zA-Z0-9 ]*: " . font-lock-comment-face)
476 ("\\*ERROR\\*" 0 font-lock-keyword-face t))
477 "Font locking keywords used for HTML error display."