Mercurial > hg > xemacs-beta
comparison lisp/w3/url.el @ 118:7d55a9ba150c r20-1b11
Import from CVS: tag r20-1b11
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:24:17 +0200 |
parents | 9f59509498e1 |
children | cca96a509cfe |
comparison
equal
deleted
inserted
replaced
117:578fd4947a72 | 118:7d55a9ba150c |
---|---|
1 ;;; url.el --- Uniform Resource Locator retrieval tool | 1 ;;; url.el --- Uniform Resource Locator retrieval tool |
2 ;; Author: wmperry | 2 ;; Author: wmperry |
3 ;; Created: 1997/03/26 20:11:33 | 3 ;; Created: 1997/04/03 15:23:07 |
4 ;; Version: 1.69 | 4 ;; Version: 1.70 |
5 ;; Keywords: comm, data, processes, hypermedia | 5 ;; Keywords: comm, data, processes, hypermedia |
6 | 6 |
7 ;;; LCD Archive Entry: | 7 ;;; LCD Archive Entry: |
8 ;;; url|William M. Perry|wmperry@cs.indiana.edu| | 8 ;;; url|William M. Perry|wmperry@cs.indiana.edu| |
9 ;;; Functions for retrieving/manipulating URLs| | 9 ;;; Functions for retrieving/manipulating URLs| |
10 ;;; 1997/03/26 20:11:33|1.69|Location Undetermined | 10 ;;; 1997/04/03 15:23:07|1.70|Location Undetermined |
11 ;;; | 11 ;;; |
12 | 12 |
13 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 13 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
14 ;;; Copyright (c) 1993-1996 by William M. Perry (wmperry@cs.indiana.edu) | 14 ;;; Copyright (c) 1993-1996 by William M. Perry (wmperry@cs.indiana.edu) |
15 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc. | 15 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc. |
666 (let (type data grok retval) | 666 (let (type data grok retval) |
667 (setq data (url-generic-parse-url url) | 667 (setq data (url-generic-parse-url url) |
668 type (url-type data)) | 668 type (url-type data)) |
669 (if (member type '("www" "about" "mailto" "mailserver" "info")) | 669 (if (member type '("www" "about" "mailto" "mailserver" "info")) |
670 (setq retval url) | 670 (setq retval url) |
671 (url-set-target data nil) | |
671 (setq retval (url-recreate-url data))) | 672 (setq retval (url-recreate-url data))) |
672 retval)) | 673 retval)) |
673 | 674 |
674 ;;;###autoload | 675 ;;;###autoload |
675 (defun url-buffer-visiting (url) | 676 (defun url-buffer-visiting (url) |
676 "Return the name of a buffer (if any) that is visiting URL." | 677 "Return the name of a buffer (if any) that is visiting URL." |
677 (setq url (url-normalize-url url)) | 678 (setq url (url-normalize-url url)) |
678 (let ((bufs (buffer-list)) | 679 (let ((bufs (buffer-list)) |
679 (found nil)) | 680 (found nil)) |
680 (if (condition-case () | |
681 (string-match "\\(.*\\)#" url) | |
682 (error nil)) | |
683 (setq url (url-match url 1))) | |
684 (while (and bufs (not found)) | 681 (while (and bufs (not found)) |
685 (save-excursion | 682 (save-excursion |
686 (set-buffer (car bufs)) | 683 (set-buffer (car bufs)) |
687 (setq found (if (and | 684 (setq found (if (and |
688 (not (string-match " \\*URL-?[0-9]*\\*" (buffer-name (car bufs)))) | 685 (not (string-match " \\*URL-?[0-9]*\\*" (buffer-name (car bufs)))) |
689 (memq major-mode '(url-mode w3-mode)) | 686 (memq major-mode '(url-mode w3-mode)) |
690 (equal (url-view-url t) url)) (car bufs) nil) | 687 (equal (url-normalize-url (url-view-url t)) url)) |
688 (car bufs) nil) | |
691 bufs (cdr bufs)))) | 689 bufs (cdr bufs)))) |
692 found)) | 690 found)) |
693 | 691 |
694 (defun url-file-size (url &rest args) | 692 (defun url-file-size (url &rest args) |
695 "Return the size of a file in bytes, or -1 if can't be determined." | 693 "Return the size of a file in bytes, or -1 if can't be determined." |