diff options
| author | Dave Love | 1997-12-22 19:26:10 +0000 |
|---|---|---|
| committer | Dave Love | 1997-12-22 19:26:10 +0000 |
| commit | ac999fb92ea9f27e0f5ff24e0e98da1448424cbc (patch) | |
| tree | 00d3d5d7864187f32de88677110966250dff9e76 | |
| parent | 8d7f1de352a629b6f28f3b66b9f3e31bba58b477 (diff) | |
| download | emacs-ac999fb92ea9f27e0f5ff24e0e98da1448424cbc.tar.gz emacs-ac999fb92ea9f27e0f5ff24e0e98da1448424cbc.zip | |
(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.
| -rw-r--r-- | lisp/browse-url.el | 64 |
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." | |||
| 262 | :group 'browse-url) | 262 | :group 'browse-url) |
| 263 | 263 | ||
| 264 | (defcustom browse-url-netscape-program "netscape" | 264 | (defcustom browse-url-netscape-program "netscape" |
| 265 | "*The name by which to invoke Netscape." | 265 | ;; Info about netscape-remote from Kurt Swanson in gnu.emacs.gnus |
| 266 | "*The name by which to invoke Netscape. | ||
| 267 | |||
| 268 | It is said that source is available for a program `netscape-remote' | ||
| 269 | which starts up very much quicker than `netscape' and that it is | ||
| 270 | useful to set this variable to the name of a script which invokes that | ||
| 271 | program like: | ||
| 272 | #!/bin/sh | ||
| 273 | /usr/local/bin/netscape-remote \"$@\" > /dev/null 2>&1 | ||
| 274 | " | ||
| 266 | :type 'string | 275 | :type 'string |
| 267 | :group 'browse-url) | 276 | :group 'browse-url) |
| 268 | 277 | ||
| @@ -301,45 +310,34 @@ commands reverses the effect of this variable. Requires Netscape version | |||
| 301 | :type '(repeat (string :tag "Argument")) | 310 | :type '(repeat (string :tag "Argument")) |
| 302 | :group 'browse-url) | 311 | :group 'browse-url) |
| 303 | 312 | ||
| 304 | (defvar browse-url-path-regexp | ||
| 305 | "[^]\t\n \"'()<>[^`{}]*[^]\t\n \"'()<>[^`{}.,;]+" | ||
| 306 | "A regular expression to match the host, path or e-mail part of a URL.") | ||
| 307 | |||
| 308 | (defvar browse-url-short-regexp | ||
| 309 | (concat "[-A-Za-z0-9.]+" browse-url-path-regexp) | ||
| 310 | "A regular expression probably matching a URL without an access scheme. | ||
| 311 | Hostname matching is stricter in this case than for | ||
| 312 | ``browse-url-regexp''.") | ||
| 313 | |||
| 314 | (defvar browse-url-regexp | ||
| 315 | (concat | ||
| 316 | "\\(https?://\\|ftp://\\|gopher://\\|telnet://\\|wais://\\|file:/\\|s?news:\\|mailto:\\)" | ||
| 317 | browse-url-path-regexp) | ||
| 318 | "A regular expression probably matching a complete URL.") | ||
| 319 | |||
| 320 | (defvar browse-url-markedup-regexp | ||
| 321 | "<URL:[^>]+>" | ||
| 322 | "A regular expression matching a URL marked up per RFC1738. | ||
| 323 | This may be broken across lines.") | ||
| 324 | |||
| 325 | (defcustom browse-url-filename-alist | 313 | (defcustom browse-url-filename-alist |
| 326 | '(("^/+" . "file:/")) | 314 | '(("^/\\(ftp@\\|anonymous@\\)?\\([^:]+\\):/*" . "ftp://\\2/") |
| 327 | "*An alist of (REGEXP . STRING) pairs. | 315 | ;; The above loses the username to avoid the browser prompting for |
| 316 | ;; it in anonymous cases. If it's not anonymous the next regexp | ||
| 317 | ;; applies. | ||
| 318 | ("^/\\([^:@]+@\\)?\\([^:]+\\):/*" . "ftp://\\1\\2/") | ||
| 319 | ("^/+" . "file:/")) | ||
| 320 | "*An alist of (REGEXP . STRING) pairs used by `browse-url-of-file'. | ||
| 328 | Any substring of a filename matching one of the REGEXPs is replaced by | 321 | Any substring of a filename matching one of the REGEXPs is replaced by |
| 329 | the corresponding STRING. All pairs are applied in the order given. | 322 | the corresponding STRING using `replace-match', not treating STRING |
| 330 | The default value prepends `file:' to any path beginning with `/'. | 323 | literally. All pairs are applied in the order given. The default |
| 331 | Used by the `browse-url-of-file' command. | 324 | value converts ange-ftp/EFS-style paths into ftp URLs and prepends |
| 325 | `file:' to any path beginning with `/'. | ||
| 332 | 326 | ||
| 333 | For example, to map EFS filenames to URLs: | 327 | For example, adding to the default a specific translation of an ange-ftp |
| 328 | address to an HTTP URL: | ||
| 334 | 329 | ||
| 335 | (setq browse-url-filename-alist | 330 | (setq browse-url-filename-alist |
| 336 | '((\"/webmaster@webserver:/home/www/html/\" . | 331 | '((\"/webmaster@webserver:/home/www/html/\" . |
| 337 | \"http://www.acme.co.uk/\") | 332 | \"http://www.acme.co.uk/\") |
| 333 | (\"^/\\(ftp@\\|anonymous@\\)?\\([^:]+\\):/*\" . \"ftp://\\2/\") | ||
| 334 | (\"^/\\([^:@]+@\\)?\\([^:]+\\):/*\" . \"ftp://\\1\\2/\") | ||
| 338 | (\"^/+\" . \"file:/\"))) | 335 | (\"^/+\" . \"file:/\"))) |
| 339 | " | 336 | " |
| 340 | :type '(repeat (cons :format "%v" | 337 | :type '(repeat (cons :format "%v" |
| 341 | (regexp :tag "Regexp") | 338 | (regexp :tag "Regexp") |
| 342 | (string :tag "Replacement"))) | 339 | (string :tag "Replacement"))) |
| 340 | :version "20.3" | ||
| 343 | :group 'browse-url) | 341 | :group 'browse-url) |
| 344 | 342 | ||
| 345 | (defcustom browse-url-save-file nil | 343 | (defcustom browse-url-save-file nil |
| @@ -512,8 +510,7 @@ interactively. Turn the filename into a URL with function | |||
| 512 | 510 | ||
| 513 | (defun browse-url-file-url (file) | 511 | (defun browse-url-file-url (file) |
| 514 | "Return the URL corresponding to FILE. | 512 | "Return the URL corresponding to FILE. |
| 515 | Use variable `browse-url-filename-alist' to map filenames to URLs. | 513 | Use variable `browse-url-filename-alist' to map filenames to URLs." |
| 516 | Convert EFS file names of the form /USER@HOST:PATH to ftp://HOST/PATH." | ||
| 517 | ;; URL-encode special chars, do % first | 514 | ;; URL-encode special chars, do % first |
| 518 | (let ((s 0)) | 515 | (let ((s 0)) |
| 519 | (while (setq s (string-match "%" file s)) | 516 | (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." | |||
| 529 | (to-string (cdr map))) | 526 | (to-string (cdr map))) |
| 530 | (setq maps (cdr maps)) | 527 | (setq maps (cdr maps)) |
| 531 | (and (string-match from-re file) | 528 | (and (string-match from-re file) |
| 532 | (setq file (replace-match to-string t t file)))))) | 529 | (setq file (replace-match to-string t nil file)))))) |
| 533 | ;; Check for EFS path | ||
| 534 | (and (string-match "^/\\([^:@]+@\\)?\\([^:]+\\):/*" file) | ||
| 535 | (setq file (concat "ftp://" | ||
| 536 | (substring file (match-beginning 2) (match-end 2)) | ||
| 537 | "/" (substring file (match-end 0))))) | ||
| 538 | file) | 530 | file) |
| 539 | 531 | ||
| 540 | ;;;###autoload | 532 | ;;;###autoload |