comparison lisp/w3/w3-emulate.el @ 110:fe104dbd9147 r20-1b7

Import from CVS: tag r20-1b7
author cvs
date Mon, 13 Aug 2007 09:19:45 +0200
parents 0d2f883870bc
children cca96a509cfe
comparison
equal deleted inserted replaced
109:e183fc049578 110:fe104dbd9147
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/02/04 19:21:18 3 ;; Created: 1997/03/14 06:12:02
4 ;; Version: 1.11 4 ;; Version: 1.12
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 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
106 ) 106 )
107 107
108 (defsubst w3-skip-word () 108 (defsubst w3-skip-word ()
109 (skip-chars-forward "^ \t\n\r") 109 (skip-chars-forward "^ \t\n\r")
110 (skip-chars-forward " \t")) 110 (skip-chars-forward " \t"))
111
112 (defun w3-read-netscape-config (&optional fname)
113 "Read in a netscape-style configuration file."
114 (interactive "fNetscape configuration file: ")
115 (if (not (and (file-exists-p fname)
116 (file-readable-p fname)))
117 (error "Could not read %s" fname))
118 (let ((results nil)
119 (tag nil)
120 (val nil)
121 (var nil)
122 (save-pos nil))
123 (save-excursion
124 (set-buffer (get-buffer-create " *w3-tmp*"))
125 (erase-buffer)
126 (insert-file-contents-literally fname)
127 (goto-char (point-min))
128 (skip-chars-forward "^ \t\r\n") ; Skip tag line
129 (skip-chars-forward " \t\r\n") ; Skip blank line(s)
130 (while (not (eobp))
131 (setq save-pos (point))
132 (skip-chars-forward "^:")
133 (upcase-region save-pos (point))
134 (setq tag (buffer-substring save-pos (point)))
135 (skip-chars-forward ":\t ")
136 (setq save-pos (point))
137 (skip-chars-forward "^\r\n")
138 (setq val (if (= save-pos (point))
139 nil
140 (buffer-substring save-pos (point))))
141 (cond
142 ((null val) nil)
143 ((string-match "^[0-9]+$" val)
144 (setq val (string-to-int val)))
145 ((string= "false" (downcase val))
146 (setq val nil))
147 ((string= "true" (downcase val))
148 (setq val t))
149 (t nil))
150 (skip-chars-forward " \t\n\r")
151 (setq results (cons (cons tag val) results))))
152 (while results
153 (setq tag (car (car results))
154 val (cdr (car results))
155 var (cdr-safe (assoc tag w3-netscape-variable-mappings))
156 results (cdr results))
157 (cond
158 ((eq var 'w3-delay-image-loads) (set var (not val)))
159 (var (set var val))
160 (t nil)))))
161 111
162 112
163 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 113 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
164 ;; Now, lets try Lynx 114 ;; Now, lets try Lynx
165 ;; ------------------ 115 ;; ------------------