;ELC   
;;; Compiled by aatharuv@cutter-john.mit.edu on Sun Jan  5 20:53:42 2003
;;; from file /afs/sipb/contrib/emacs/packages/emacs-w3m-1.3.3-src/w3m-util.el
;;; in Emacs version 21.1.1
;;; with bytecomp version 2.85
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.29")))
    (error "`w3m-util.el' was compiled for Emacs 19.29 or later"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(condition-case nil :symbol-for-testing-whether-colon-keyword-is-available-or-not (void-variable (let (w3m-colon-keywords) (load "w3m-kwds.el" nil t t) (while w3m-colon-keywords (set (car w3m-colon-keywords) (car w3m-colon-keywords)) (setq w3m-colon-keywords (cdr w3m-colon-keywords))))))
(byte-code "\301\302!\204 \303\300!\203 \304W\203 \305\306!\210\305\307!\210\303\300!\203/ \310U\203/ \311\312\313\"\210\305\314!\210\301\207" [emacs-major-version featurep xemacs boundp 20 require poe poem 19 autoload cancel-timer "timer" custom] 3)
#@59 Like `if', except that it evaluates COND at compile-time.
(defalias 'w3m-static-if '(macro . #[(cond then &rest else) "\303!\203 	\207\304\nB\207" [cond then else eval progn] 2 (#$ . 1185)]))
(byte-code "\300\301\302\303#\210\300\304\302\305#\207" [put w3m-static-if lisp-indent-function 2 w3m-static-when 1] 4)
#@49 Like `when', but evaluate COND at compile time.
(defalias 'w3m-static-when '(macro . #[(cond &rest body) "\302!\205	 \303	B\207" [cond body eval progn] 2 (#$ . 1505)]))
(put 'w3m-static-unless 'lisp-indent-function 1)
#@51 Like `unless', but evaluate COND at compile time.
(defalias 'w3m-static-unless '(macro . #[(cond &rest body) "\302!?\205\n \303	B\207" [cond body eval progn] 2 (#$ . 1730)]))
#@86 Like `cond', except that it evaluates CONDITION part of each clause at
compile-time.
(defalias 'w3m-static-cond '(macro . #[(&rest clauses) "\203 \301@@!\204 A\211\204 \205 \302@AB\207" [clauses eval progn] 3 (#$ . 1912)]))
(put 'w3m-condition-case lisp-indent-function 2)
#@103 Like `condition-case', except that signal an error if `debug-on-error'
or `debug-on-quit' is non-nil.
(defalias 'w3m-condition-case '(macro . #[(var bodyform &rest handlers) "\303\304\305	\nBBBF\207" [bodyform var handlers if (or debug-on-error debug-on-quit) condition-case] 7 (#$ . 2202)]))
#@66 Like `add-text-properties' but always add non-sticky properties.
(defalias 'w3m-add-text-properties '(macro . #[(start end props &optional object) "\305\306!\203\n \307\202 \310\311	\n\312E\f\257)\207" [non-stickies start end props object featurep xemacs (list 'start-open t) (list 'rear-nonsticky t) add-text-properties append] 6 (#$ . 2503)]))
#@175 Search for the text property PROP in the POSITION and return a value
or nil.  If POSITION is omitted, searching is performed in the current
cursor position and around there.
(defalias 'w3m-get-text-property-around '(macro . #[(prop &optional position) "\203	 \302	E\207\303\304\305\302\300	E\306\307\302\310	EE\306\311\302\312	EEFE\207" [position prop get-text-property let ((position (point))) or and (not (bolp)) (1- position) (not (eolp)) (1+ position)] 10 (#$ . 2861)]))
(defalias 'w3m-action '(macro . #[(&optional position) "\301\302E\207" [position w3m-get-text-property-around 'w3m-action] 3]))
(defalias 'w3m-anchor '(macro . #[(&optional position) "\301\302E\207" [position w3m-get-text-property-around 'w3m-href-anchor] 3]))
(defalias 'w3m-image '(macro . #[(&optional position) "\301\302E\207" [position w3m-get-text-property-around 'w3m-image] 3]))
(defalias 'w3m-image-scale '(macro . #[(&optional position) "\301\302E\207" [position w3m-get-text-property-around 'w3m-image-scale] 3]))
(defalias 'w3m-submit '(macro . #[(&optional position) "\301\302E\207" [position w3m-get-text-property-around 'w3m-submit] 3]))
(defalias 'w3m-anchor-sequence '(macro . #[(&optional position) "\203\n \301\302BB\207\303\207" [position get-text-property ('w3m-anchor-sequence) (get-text-property (point) 'w3m-anchor-sequence)] 3]))
(byte-code "\300\301\302\303#\210\300\301\304\305#\207" [put w3m-parse-attributes lisp-indent-function 1 edebug-form-spec ((&rest &or (symbolp &optional symbolp) symbolp) body)] 4)
(defalias 'w3m-parse-attributes '(macro . #[(attributes &rest form) "\303\304\305\"\306\307\310\311\304\312\"\313\314	PDC\315B\"B\316BB\317\320\nBBBBBB\207" [attributes w3m-html-string-regexp form let mapcar #[(attr) "<\203 @\207\207" [attr] 1] (skip-chars-forward " 	\f\n") while cond append #[(attr) "9\204 <\203 G\304X\203 @9\204 \305\306!\210\307\310<\203g A@\211\311=\2035 \312\nD\202d 	\313=\203B \314\nD\202d 	\315=\203M \316\202d 	\317=\203Z \320\nD\202d A@\203d \305\321!\210@\322	\315=\203t \323!\202{ \324\325\323!#D\326\nE*D\207" [attr type sexp w3m-html-string-regexp 2 error "Internal error, type mismatch" (w3m-remove-redundant-spaces (or (match-string-no-properties 2) (match-string-no-properties 3) (match-string-no-properties 1))) nil :case-ignore downcase :integer string-to-number :bool t :decode-entity w3m-decode-entities-string "Internal error, unknown modifier" looking-at symbol-name format "%s[ 	\f\n]*=[ 	\f\n]*%s" setq] 6] looking-at "[A-Za-z]*[ 	\f\n]*=[ 	\f\n]*" (((looking-at "[^<> 	\f\n]+"))) ((goto-char (match-end 0)) (skip-chars-forward " 	\f\n")) (skip-chars-forward "^>") (forward-char)] 10]))
#@70 Return the buffer named NAME, or create such a buffer and return it.
(defalias 'w3m-get-buffer-create #[(name) "\303!\206 \304!\211\nB\305	!\210	)\207" [name buf w3m-work-buffer-list get-buffer get-buffer-create buffer-disable-undo] 3 (#$ . 5555)])
(put 'w3m-get-buffer-create 'byte-optimizer 'byte-compile-inline-expand)
#@178 Kill the buffer BUFFER and remove it from `w3m-work-buffer-list'.
The argument may be a buffer or may be the name of a buffer.
An argument of nil means kill the current buffer.
(defalias 'w3m-kill-buffer #[(buffer) "\204 p;\203 \302!\303!\203 \304!\210\305	\"\306\207" [buffer w3m-work-buffer-list get-buffer buffer-live-p kill-buffer delq nil] 3 (#$ . 5889)])
(put 'w3m-kill-buffer 'byte-optimizer 'byte-compile-inline-expand)
#@26 Kill all working buffer.
(defalias 'w3m-kill-all-buffer #[nil "\303\211\203 \n@\304	!\203 \305	!\210\nA\211\204 *\303\211\207" [w3m-work-buffer-list buf #1=#:--dolist-temp--3903 nil buffer-live-p kill-buffer] 3 (#$ . 6335)])
#@40 Return the title of the buffer BUFFER.
(defalias 'w3m-buffer-title #[(buffer) "rq\210	;\203 	\303\230\204 	\202. \n;\203- \304\305\306\n\"\203( \n\307\225\310O\202) \n!\202. \303)\207" [buffer w3m-current-title w3m-current-url "<no-title>" directory-file-name string-match "^[^/:]+:/+" 0 nil] 4 (#$ . 6575)])
(put 'w3m-buffer-title 'byte-optimizer 'byte-compile-inline-expand)
(defalias 'w3m-buffer-number #[(buffer) "\301!\205 \302\303\304!\"\205 \305\224\203 \306\307\310\304!\"!\207\305\207" [buffer bufferp string-match "\\`\\*w3m\\*\\(<\\([0-9]+\\)>\\)?\\'" buffer-name 1 string-to-number match-string 2] 5])
(put 'w3m-buffer-number 'byte-optimizer 'byte-compile-inline-expand)
(defalias 'w3m-buffer-set-number #[(buffer number) "\303!\205\" \304\305\306!\"\205\" \307\224\203! \310\311\312\306!\"!\202\" \307)	=?\205G rq\210	\307U\2037 \313\202; \314\315	\"\316\n!?\205F \317\n!*\207" [buffer number newname bufferp string-match "\\`\\*w3m\\*\\(<\\([0-9]+\\)>\\)?\\'" buffer-name 1 string-to-number match-string 2 "*w3m*" format "*w3m*<%d>" get-buffer rename-buffer] 5])
(put 'w3m-buffer-set-number 'byte-optimizer 'byte-compile-inline-expand)
#@58 Return t if first arg buffer's name is less than second.
(defalias 'w3m-buffer-name-lessp #[(x y) "\302!\203\n \303!\302	!\203 \303	!\304\305\"\203P \306\224\203* \307\310\311\"!\202+ \306B\211\203P \304\305	\"\203K A\306\224\203H \307\310\311	\"!\202I \306W\207@	\231\207	\231\207" [x y bufferp buffer-name string-match "\\`\\*w3m\\*\\(<\\([0-9]+\\)>\\)?\\'" 1 string-to-number match-string 2] 5 (#$ . 7747)])
#@34 Return list of w3m-mode buffers.
(defalias 'w3m-list-buffers #[(&optional nosort) "\203 r\301\302\303\304\305 \"\")\207\306\307\310!\311\"\207" [nosort delq nil mapcar #[(buffer) "q\210	\302=\205\n \207" [buffer major-mode w3m-mode] 2] buffer-list sort w3m-list-buffers t w3m-buffer-name-lessp] 5 (#$ . 8176)])
(put 'w3m-list-buffers 'byte-optimizer 'byte-compile-inline-expand)
#@192 Return a regexp string, not a funtion form.  A regexp should match tags
which are started with "<" and one of NAMES.  NAMES should be string
constants, any other expressions are not allowed.
(defalias 'w3m-tag-regexp-of '(macro . #[(&rest names) "\301\302\303\304#\305Q\207" [names "<\\(" mapconcat identity "\\|" "\\)\\([ 	\f\n]+[^>]*\\)?/?>"] 5 (#$ . 8566)]))
#@164 Return t, if A is newer than B.  Otherwise return nil.
A and B are lists which represent time in Emacs-style.  If value is
nil, it is regarded as the oldest time.
(defalias 'w3m-time-newer-p #[(a b) "\205  	?\206  @	@V\206  @	@U\205  A@	A@V\207" [a b] 2 (#$ . 8937)])
(put 'w3m-time-newer-p 'byte-optimizer 'byte-compile-inline-expand)
#@102 Return lapse seconds from START to END.
START and END are lists which represent time in Emacs-style.
(defalias 'w3m-time-lapse-seconds #[(start end) "@	@Z\303_\211A@)\\	\211A@)[\\\207" [end start x 65536] 3 (#$ . 9284)])
(put 'w3m-time-lapse-seconds 'byte-optimizer 'byte-compile-inline-expand)
#@75 If URL points a 'w3m-dtree', return non-nil value.  Otherwise return
nil.
(defalias 'w3m-url-dtree-p #[(url) "\301\302\"\207" [url string-match "\\`about://dtree/"] 3 (#$ . 9589)])
(put 'w3m-url-dtree-p 'byte-optimizer 'byte-compile-inline-expand)
#@87 If URL points a file on the local system, return non-nil value.
Otherwise return nil.
(defalias 'w3m-url-local-p #[(url) "\301\302\"\207" [url string-match "^\\(file:\\|/\\|[a-zA-Z]:/\\)"] 3 (#$ . 9844)])
(put 'w3m-url-local-p 'byte-optimizer 'byte-compile-inline-expand)
#@75 Regular expression for parsing the authentication part of a URI reference
(defconst w3m-url-authinfo-regexp "\\`\\([^:/?#]+:\\)?//\\([^/?#:]+\\)\\(:\\([^/?#@]+\\)\\)?@" (#$ . 10123))
#@56 Return a user name and a password to authenticate URL.
(defalias 'w3m-url-authinfo #[(url) "\302	\"\205 \303\304	\"\303\305	\"B\207" [w3m-url-authinfo-regexp url string-match match-string 2 4] 4 (#$ . 10312)])
(put 'w3m-url-authinfo 'byte-optimizer 'byte-compile-inline-expand)
#@46 Remove the authentication part from the URL.
(defalias 'w3m-url-strip-authinfo #[(url) "\302	\"\203 \303\304	\"\305	\306\225\307OQ\207	\207" [w3m-url-authinfo-regexp url string-match match-string 1 "//" 0 nil] 5 (#$ . 10598)])
(put 'w3m-url-strip-authinfo 'byte-optimizer 'byte-compile-inline-expand)
#@46 Remove the fragment identifier from the URL.
(defalias 'w3m-url-strip-fragment #[(url) "\301\302\"\203\f \303\304\"\207\207" [url string-match "\\`\\([^#]*\\)#" match-string 1] 3 (#$ . 10907)])
(put 'w3m-url-strip-fragment 'byte-optimizer 'byte-compile-inline-expand)
#@65 Remove the query part and the fragment identifier from the URL.
(defalias 'w3m-url-strip-query #[(url) "\301\302\"\203\f \303\304\"\207\207" [url string-match "\\`\\([^?#]*\\)[?#]" match-string 1] 3 (#$ . 11184)])
(put 'w3m-url-strip-query 'byte-optimizer 'byte-compile-inline-expand)
(defalias 'w3m-which-command #[(command) ";\205 \301!\203 \302!\203 \207\303!\304\305\215\207" [command file-name-absolute-p file-executable-p file-name-nondirectory found-command (byte-code "\305	\305\211\2031 @\306\307\f\n\"\211!\204% \306\307\f\310P\n\"\211!\203* \311\312\"\210A\211\204\n +\305\207" [bin exec-path dir #1=#:--dolist-temp--3904 command nil file-executable-p expand-file-name ".exe" throw found-command] 5)] 2])
(put 'w3m-which-command 'byte-optimizer 'byte-compile-inline-expand)
#@53 Cancel the timer for REFRESH attribute in META tag.
(defalias 'w3m-cancel-refresh-timer #[(&optional buffer) "\205 r	\206\n pq\210\304\205 \305!\210\304\211)\207" [w3m-use-refresh buffer w3m-current-refresh w3m-refresh-timer nil cancel-timer] 2 (#$ . 11997)])
(byte-code "\300\301\302\303!\203\f \304\202 \305\"\207" [defalias w3m-truncate-string featurep xemacs #[(str end-column) "G\305\211\306\307\310\217\210\n\fV\203 	S\305	O+\207" [str idx column len end-column 0 nil (byte-code "	W\203 \304\nH!\\T\202  \304\207" [column end-column str idx char-width] 4) ((args-out-of-range (byte-code "\302\207" [len idx nil] 1)))] 3 "Truncate string STR to end at column END-COLUMN."] truncate-string] 4)
#@70 Return the element of ALIST whose car equals NAME ignoring its case.
(defalias 'w3m-assoc-ignore-case #[(name alist) "\227\304\203$ @:\203 \n@@\227\230\203 @\304A\211\204	 	*\207" [name match dname alist nil] 3 (#$ . 12725)])
(put 'w3m-assoc-ignore-case 'byte-optimizer 'byte-compile-inline-expand)
#@86 Like `prin1', except that control chars will be represented with ^ as
`cat -v' does.
(defalias 'w3m-prin1 #[(object &optional stream) ";\203W \305\306\305\"\305\211\203H @\211\307=\203\" \310	B\202A \n\311>\204. \n\312Y\2037 \313\n!	B\202A \314\313\n\315\\!P	BA\211\204 \305	*\210\316\317\320	\237\"\f\")\207\316\f\"\207" [object rest char #1=#:--dolist-temp--3905 stream nil append 127 "^?" (9 10) 32 char-to-string "^" 64 prin1 apply concat] 5 (#$ . 13043)])
#@62 *If non-nil, preserve echo messages in the *Message* buffer.
(defvar w3m-display-message-enable-logging nil (#$ . -13525))
#@113 Like `message', except that message logging is controlled by the
variable `w3m-display-message-enable-logging'.
(defalias 'w3m-display-message '(macro . #[(string &rest args) "\302\303!\203 \203 \304\305\306	BBE\207\304\307	E\207\310\311\312	BBE\207" [args string featurep xemacs display-message (if w3m-display-message-enable-logging 'message 'no-log) format (if w3m-display-message-enable-logging 'message 'no-log) let ((message-log-max (if w3m-display-message-enable-logging message-log-max))) message] 5 (#$ . 13655)]))
#@58 Show "Reading URL..." message in the middle of a buffer.
(defalias 'w3m-display-progress-message #[(url) "\303\304\305 S\306\245]\307\"\310\311	\"\203\" \312\313\"\314\304\225\315OQ\202# )\316\261\210\317 \210\320 \321`d\"\210)eb\210\322\304!\207" [url w3m-url-authinfo-regexp fill-column make-string 0 window-height 2 10 "Reading " string-match match-string 1 "//" nil "..." beginning-of-line window-width center-region sit-for] 7 (#$ . 14190)])
(byte-code "\300\301!\203 \302\303\304\"\210\202 \305\306!\210\303\307M\210\300\207" [featurep xemacs defalias w3m-function-max-args function-max-args require advice #[(function) "\3029\203 K\202\f !\303	>?\205 \304\305	\"G)\207" [function arglist ad-arglist &rest delq &optional] 3 "Return the maximum number of arguments a function may be called with.\nThe function may be any form that can be passed to `funcall',\nany special form, or any macro.\nIf the function takes an arbitrary number of arguments or is\na built-in special form, nil is returned."]] 3)
#@176 Change values in PLIST corresponding to PROPERTIES.  This is similar
to `plist-put', but handles plural symbol and value pairs and remove
pairs from PLIST whose value is nil.
(defalias 'w3m-modify-plist #[(plist &rest properties) "\203 \303	@\211A@)#\211AA)\211\204 	\203? 	\211A@)\2034 	@	\211A@)D\244	\211AA)\211\204 \207" [properties plist x plist-put] 5 (#$ . 15221)])
#@92 Insert STRING at point without conversions in either case the
multibyteness of the buffer.
(defalias 'w3m-insert-string '(macro . #[(string) "\301\302!\203 \303\302K!\203 \304\300DC\305BB\207\306D\207" [string fboundp string-as-multibyte subrp let ((insert (if enable-multibyte-characters (string-as-multibyte string) (string-as-unibyte string)))) insert] 3 (#$ . 15618)]))
#@207 The initial `default' face color spec.  Since `defface' under FSF Emacs
versions prior to 21 won't inherit the `dafault' face colors by default,
we will use this value for the default `defface' color spec.
(defconst w3m-default-face-colors (eval '(if (not (or (featurep 'xemacs) (>= emacs-major-version 21))) (let ((bg (face-background 'default)) (fg (face-foreground 'default))) (append (if bg `(:background ,bg)) (if fg `(:foreground ,fg)))))) (#$ . 16003))
#@74 Initialize the hook option pointed by the SYMBOL with the default VALUE.
(defalias 'w3m-custom-hook-initialize #[(symbol value) "\302!\203 \303	!\211\205 \304	@\"\210	A\211\202 \305	\"\207" [symbol value boundp eval add-hook custom-initialize-set] 4 (#$ . 16469)])
(provide 'w3m-util)
