summaryrefslogtreecommitdiff
path: root/lisp/browse-url.el
diff options
context:
space:
mode:
authorDave Love <fx@gnu.org>1997-12-22 19:26:10 +0000
committerDave Love <fx@gnu.org>1997-12-22 19:26:10 +0000
commit4451503e16324176ab1d5ffc9d10e5d209ac08c9 (patch)
treebab95972fd23383e91c238b81236f0f689fbf809 /lisp/browse-url.el
parent79b89c0f556d300d3c7a7d4e9cdee0a39d142e37 (diff)
downloademacs-4451503e16324176ab1d5ffc9d10e5d209ac08c9.tar.gz
(browse-url-path-regexp, browse-url-short-regexp,
browse-url-regexp): Variables deleted. (They were moved to thingatpt.el.) (browse-url-filename-alist): Default now has leading ange-ftp-type patterns so that the "^/+" pattern doesn't mung such names in advance. (browse-url-file-url): Don't do explicit ange-ftp path munging here. (browse-url-netscape-program): Doc addition.
Diffstat (limited to 'lisp/browse-url.el')
-rw-r--r--lisp/browse-url.el64
1 files changed, 28 insertions, 36 deletions
diff --git a/lisp/browse-url.el b/lisp/browse-url.el
index eeec6232951..23ad63919f5 100644
--- a/lisp/browse-url.el
+++ b/lisp/browse-url.el
@@ -262,7 +262,16 @@ regexp should probably be \".\" to specify a default browser."
:group 'browse-url)
(defcustom browse-url-netscape-program "netscape"
- "*The name by which to invoke Netscape."
+ ;; Info about netscape-remote from Kurt Swanson in gnu.emacs.gnus
+ "*The name by which to invoke Netscape.
+
+It is said that source is available for a program `netscape-remote'
+which starts up very much quicker than `netscape' and that it is
+useful to set this variable to the name of a script which invokes that
+program like:
+ #!/bin/sh
+ /usr/local/bin/netscape-remote \"$@\" > /dev/null 2>&1
+"
:type 'string
:group 'browse-url)
@@ -301,45 +310,34 @@ commands reverses the effect of this variable. Requires Netscape version
:type '(repeat (string :tag "Argument"))
:group 'browse-url)
-(defvar browse-url-path-regexp
- "[^]\t\n \"'()<>[^`{}]*[^]\t\n \"'()<>[^`{}.,;]+"
- "A regular expression to match the host, path or e-mail part of a URL.")
-
-(defvar browse-url-short-regexp
- (concat "[-A-Za-z0-9.]+" browse-url-path-regexp)
- "A regular expression probably matching a URL without an access scheme.
-Hostname matching is stricter in this case than for
-``browse-url-regexp''.")
-
-(defvar browse-url-regexp
- (concat
- "\\(https?://\\|ftp://\\|gopher://\\|telnet://\\|wais://\\|file:/\\|s?news:\\|mailto:\\)"
- browse-url-path-regexp)
- "A regular expression probably matching a complete URL.")
-
-(defvar browse-url-markedup-regexp
- "<URL:[^>]+>"
- "A regular expression matching a URL marked up per RFC1738.
-This may be broken across lines.")
-
(defcustom browse-url-filename-alist
- '(("^/+" . "file:/"))
- "*An alist of (REGEXP . STRING) pairs.
+ '(("^/\\(ftp@\\|anonymous@\\)?\\([^:]+\\):/*" . "ftp://\\2/")
+ ;; The above loses the username to avoid the browser prompting for
+ ;; it in anonymous cases. If it's not anonymous the next regexp
+ ;; applies.
+ ("^/\\([^:@]+@\\)?\\([^:]+\\):/*" . "ftp://\\1\\2/")
+ ("^/+" . "file:/"))
+ "*An alist of (REGEXP . STRING) pairs used by `browse-url-of-file'.
Any substring of a filename matching one of the REGEXPs is replaced by
-the corresponding STRING. All pairs are applied in the order given.
-The default value prepends `file:' to any path beginning with `/'.
-Used by the `browse-url-of-file' command.
+the corresponding STRING using `replace-match', not treating STRING
+literally. All pairs are applied in the order given. The default
+value converts ange-ftp/EFS-style paths into ftp URLs and prepends
+`file:' to any path beginning with `/'.
-For example, to map EFS filenames to URLs:
+For example, adding to the default a specific translation of an ange-ftp
+address to an HTTP URL:
(setq browse-url-filename-alist
'((\"/webmaster@webserver:/home/www/html/\" .
\"http://www.acme.co.uk/\")
+ (\"^/\\(ftp@\\|anonymous@\\)?\\([^:]+\\):/*\" . \"ftp://\\2/\")
+ (\"^/\\([^:@]+@\\)?\\([^:]+\\):/*\" . \"ftp://\\1\\2/\")
(\"^/+\" . \"file:/\")))
"
:type '(repeat (cons :format "%v"
(regexp :tag "Regexp")
(string :tag "Replacement")))
+ :version "20.3"
:group 'browse-url)
(defcustom browse-url-save-file nil
@@ -512,8 +510,7 @@ interactively. Turn the filename into a URL with function
(defun browse-url-file-url (file)
"Return the URL corresponding to FILE.
-Use variable `browse-url-filename-alist' to map filenames to URLs.
-Convert EFS file names of the form /USER@HOST:PATH to ftp://HOST/PATH."
+Use variable `browse-url-filename-alist' to map filenames to URLs."
;; URL-encode special chars, do % first
(let ((s 0))
(while (setq s (string-match "%" file s))
@@ -529,12 +526,7 @@ Convert EFS file names of the form /USER@HOST:PATH to ftp://HOST/PATH."
(to-string (cdr map)))
(setq maps (cdr maps))
(and (string-match from-re file)
- (setq file (replace-match to-string t t file))))))
- ;; Check for EFS path
- (and (string-match "^/\\([^:@]+@\\)?\\([^:]+\\):/*" file)
- (setq file (concat "ftp://"
- (substring file (match-beginning 2) (match-end 2))
- "/" (substring file (match-end 0)))))
+ (setq file (replace-match to-string t nil file))))))
file)
;;;###autoload