Mercurial > emacs
comparison lisp/browse-url.el @ 20320:dfd02d692b0c
Doc fixes and extra customization.
(browse-url): Quote browse-url-choose-browser in application.
author | Dave Love <fx@gnu.org> |
---|---|
date | Fri, 21 Nov 1997 23:57:48 +0000 |
parents | 5bd2ed765d52 |
children | 9bef2b27cdaa |
comparison
equal
deleted
inserted
replaced
20319:81424cf4d446 | 20320:dfd02d692b0c |
---|---|
4 | 4 |
5 ;; Author: Denis Howe <dbh@doc.ic.ac.uk> | 5 ;; Author: Denis Howe <dbh@doc.ic.ac.uk> |
6 ;; Maintainer: Dave Love <d.love@dl.ac.uk> | 6 ;; Maintainer: Dave Love <d.love@dl.ac.uk> |
7 ;; Created: 03 Apr 1995 | 7 ;; Created: 03 Apr 1995 |
8 ;; Keywords: hypertext, hypermedia, mouse | 8 ;; Keywords: hypertext, hypermedia, mouse |
9 ;; X-Home page: http://wombat.doc.ic.ac.uk/ | |
10 | 9 |
11 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
12 | 11 |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
14 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
154 | 153 |
155 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 154 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
156 ;; Customisation (~/.emacs) | 155 ;; Customisation (~/.emacs) |
157 | 156 |
158 ;; To see what variables are available for customization, type | 157 ;; To see what variables are available for customization, type |
159 ;; `M-x set-variable browse-url TAB'. | 158 ;; `M-x set-variable browse-url TAB'. Better, use |
159 ;; `M-x customize-group browse-url'. | |
160 | 160 |
161 ;; Bind the browse-url commands to keys with the `C-c C-z' prefix | 161 ;; Bind the browse-url commands to keys with the `C-c C-z' prefix |
162 ;; (as used by html-helper-mode): | 162 ;; (as used by html-helper-mode): |
163 ;; (global-set-key "\C-c\C-z." 'browse-url-at-point) | 163 ;; (global-set-key "\C-c\C-z." 'browse-url-at-point) |
164 ;; (global-set-key "\C-c\C-zb" 'browse-url-of-buffer) | 164 ;; (global-set-key "\C-c\C-zb" 'browse-url-of-buffer) |
225 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 225 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
226 ;; Variables | 226 ;; Variables |
227 | 227 |
228 (defgroup browse-url nil | 228 (defgroup browse-url nil |
229 "Use a web browser to look at a URL." | 229 "Use a web browser to look at a URL." |
230 :prefix "browse-url-" | |
230 :group 'hypermedia) | 231 :group 'hypermedia) |
231 | 232 |
232 ;;;###autoload | 233 ;;;###autoload |
233 (defcustom browse-url-browser-function | 234 (defcustom browse-url-browser-function |
234 'browse-url-netscape | 235 'browse-url-netscape |
304 (defvar browse-url-markedup-regexp | 305 (defvar browse-url-markedup-regexp |
305 "<URL:[^>]+>" | 306 "<URL:[^>]+>" |
306 "A regular expression matching a URL marked up per RFC1738. | 307 "A regular expression matching a URL marked up per RFC1738. |
307 This may be broken across lines.") | 308 This may be broken across lines.") |
308 | 309 |
309 (defvar browse-url-filename-alist | 310 (defcustom browse-url-filename-alist |
310 '(("^/+" . "file:/")) | 311 '(("^/+" . "file:/")) |
311 "An alist of (REGEXP . STRING) pairs. | 312 "*An alist of (REGEXP . STRING) pairs. |
312 Any substring of a filename matching one of the REGEXPs is replaced by | 313 Any substring of a filename matching one of the REGEXPs is replaced by |
313 the corresponding STRING. All pairs are applied in the order given. | 314 the corresponding STRING. All pairs are applied in the order given. |
314 The default value prepends `file:' to any path beginning with `/'. | 315 The default value prepends `file:' to any path beginning with `/'. |
315 Used by the `browse-url-of-file' command. | 316 Used by the `browse-url-of-file' command. |
316 | 317 |
318 | 319 |
319 (setq browse-url-filename-alist | 320 (setq browse-url-filename-alist |
320 '((\"/webmaster@webserver:/home/www/html/\" . | 321 '((\"/webmaster@webserver:/home/www/html/\" . |
321 \"http://www.acme.co.uk/\") | 322 \"http://www.acme.co.uk/\") |
322 (\"^/+\" . \"file:/\"))) | 323 (\"^/+\" . \"file:/\"))) |
323 ") | 324 " |
324 | 325 :type '(repeat (cons :format "%v" |
325 (defvar browse-url-save-file nil | 326 (string :tag "Regexp") |
326 "If non-nil, save the buffer before displaying its file. | 327 (string :tag "Replacement"))) |
327 Used by the `browse-url-of-file' command.") | 328 :group 'browse-url) |
328 | 329 |
329 (defvar browse-url-of-file-hook nil | 330 (defcustom browse-url-save-file nil |
330 "Run after `browse-url-of-file' has asked a browser to load a file. | 331 "*If non-nil, save the buffer before displaying its file. |
332 Used by the `browse-url-of-file' command." | |
333 :type 'boolean | |
334 :group 'browse-url) | |
335 | |
336 (defcustom browse-url-of-file-hook nil | |
337 "*Run after `browse-url-of-file' has asked a browser to load a file. | |
331 | 338 |
332 Set this to `browse-url-netscape-reload' to force Netscape to load the | 339 Set this to `browse-url-netscape-reload' to force Netscape to load the |
333 file rather than displaying a cached copy.") | 340 file rather than displaying a cached copy." |
341 :type 'hook | |
342 :group 'browse-url) | |
334 | 343 |
335 (defvar browse-url-usr1-signal | 344 (defvar browse-url-usr1-signal |
336 (if (and (boundp 'emacs-major-version) | 345 (if (and (boundp 'emacs-major-version) |
337 (or (> emacs-major-version 19) (>= emacs-minor-version 29))) | 346 (or (> emacs-major-version 19) (>= emacs-minor-version 29))) |
338 'SIGUSR1 ; Why did I think this was in lower case before? | 347 'SIGUSR1 ; Why did I think this was in lower case before? |
339 30) ; Check /usr/include/signal.h. | 348 30) ; Check /usr/include/signal.h. |
340 "The argument to `signal-process' for sending SIGUSR1 to XMosaic. | 349 "The argument to `signal-process' for sending SIGUSR1 to XMosaic. |
341 Emacs 19.29 accepts 'SIGUSR1, earlier versions require an integer | 350 Emacs 19.29 accepts 'SIGUSR1, earlier versions require an integer |
342 which is 30 on SunOS and 16 on HP-UX and Solaris.") | 351 which is 30 on SunOS and 16 on HP-UX and Solaris.") |
343 | 352 |
344 (defvar browse-url-CCI-port 3003 | 353 (defcustom browse-url-CCI-port 3003 |
345 "Port to access XMosaic via CCI. | 354 "*Port to access XMosaic via CCI. |
346 This can be any number between 1024 and 65535 but must correspond to | 355 This can be any number between 1024 and 65535 but must correspond to |
347 the value set in the browser.") | 356 the value set in the browser." |
348 | 357 :type 'integer |
349 (defvar browse-url-CCI-host "localhost" | 358 :group 'browse-url) |
359 | |
360 (defcustom browse-url-CCI-host "localhost" | |
350 "*Host to access XMosaic via CCI. | 361 "*Host to access XMosaic via CCI. |
351 This should be the host name of the machine running XMosaic with CCI | 362 This should be the host name of the machine running XMosaic with CCI |
352 enabled. The port number should be set in `browse-url-CCI-port'.") | 363 enabled. The port number should be set in `browse-url-CCI-port'." |
364 :type 'string | |
365 :group 'browse-url) | |
353 | 366 |
354 (defvar browse-url-temp-file-name nil) | 367 (defvar browse-url-temp-file-name nil) |
355 (make-variable-buffer-local 'browse-url-temp-file-name) | 368 (make-variable-buffer-local 'browse-url-temp-file-name) |
356 | 369 |
357 (defcustom browse-url-xterm-program "xterm" | 370 (defcustom browse-url-xterm-program "xterm" |
402 This affects how URL reloading is done; the mechanism changed | 415 This affects how URL reloading is done; the mechanism changed |
403 incompatibly at version 4." | 416 incompatibly at version 4." |
404 :type 'number | 417 :type 'number |
405 :group 'browse-url) | 418 :group 'browse-url) |
406 | 419 |
407 (defvar browse-url-lynx-input-field 'avoid | 420 (defcustom browse-url-lynx-input-field 'avoid |
408 "*Action on selecting an existing Lynx buffer at an input field. | 421 "*Action on selecting an existing Lynx buffer at an input field. |
409 What to do when sending a new URL to an existing Lynx buffer in Emacs | 422 What to do when sending a new URL to an existing Lynx buffer in Emacs |
410 if the Lynx cursor is on an input field (in which case the `g' command | 423 if the Lynx cursor is on an input field (in which case the `g' command |
411 would be entered as data). Such fields are recognized by the | 424 would be entered as data). Such fields are recognized by the |
412 underlines ____. Allowed values: nil: disregard it, 'warn: warn the | 425 underlines ____. Allowed values: nil: disregard it, 'warn: warn the |
413 user and don't emit the URL, 'avoid: try to avoid the field by moving | 426 user and don't emit the URL, 'avoid: try to avoid the field by moving |
414 down (this *won't* always work).") | 427 down (this *won't* always work)." |
415 | 428 :type '(choice (const :tag "Move to try to avoid field" :value avoid) |
416 (defvar browse-url-lynx-input-attempts 10 | 429 (const :tag "Disregard" :value nil) |
417 "*How many times to try to move down from a series of lynx input fields.") | 430 (const :tag "Warn, don't emit URL" :value warn)) |
418 | 431 :group 'browse-url) |
419 (defvar browse-url-lynx-input-delay 0.2 | 432 |
420 "*How many seconds to wait for lynx between moves down from an input field.") | 433 (defcustom browse-url-lynx-input-attempts 10 |
434 "*How many times to try to move down from a series of lynx input fields." | |
435 :type 'integer | |
436 :group 'browse-url) | |
437 | |
438 (defcustom browse-url-lynx-input-delay 0.2 | |
439 "*How many seconds to wait for lynx between moves down from an input field." | |
440 :type 'number | |
441 :group 'browse-url) | |
421 | 442 |
422 (defvar browse-url-temp-file-list '()) | 443 (defvar browse-url-temp-file-list '()) |
423 | 444 |
424 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 445 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
425 ;; URL input | 446 ;; URL input |
575 "Ask a WWW browser to load URL. | 596 "Ask a WWW browser to load URL. |
576 Prompts for a URL, defaulting to the URL at or before point. Variable | 597 Prompts for a URL, defaulting to the URL at or before point. Variable |
577 `browse-url-browser-function' says which browser to use." | 598 `browse-url-browser-function' says which browser to use." |
578 (interactive (browse-url-interactive-arg "URL: ")) | 599 (interactive (browse-url-interactive-arg "URL: ")) |
579 (if (consp browse-url-browser-function) | 600 (if (consp browse-url-browser-function) |
580 (apply browse-url-choose-browser args) | 601 (apply 'browse-url-choose-browser args) |
581 (apply browse-url-browser-function args))) | 602 (apply browse-url-browser-function args))) |
582 | 603 |
583 (defun browse-url-choose-browser (url &rest args) | 604 (defun browse-url-choose-browser (url &rest args) |
584 "Pass URL to a browser function chosen. | 605 "Pass URL to a browser function chosen. |
585 This is done according to the association list in variable | 606 This is done according to the association list in variable |