diff options
| author | Dave Love | 1998-03-06 18:56:39 +0000 |
|---|---|---|
| committer | Dave Love | 1998-03-06 18:56:39 +0000 |
| commit | a43d1a2aa53e428ca2b133b734a59f51bcebf7f3 (patch) | |
| tree | a6e8a4519a4ae4a7c7395bd8f1409d1e63840871 | |
| parent | 728f84dcd840815683099a720a7283194f6534eb (diff) | |
| download | emacs-a43d1a2aa53e428ca2b133b734a59f51bcebf7f3.tar.gz emacs-a43d1a2aa53e428ca2b133b734a59f51bcebf7f3.zip | |
Various doc fixes, mainly to remove innappropriate
leading "*"s.
(browse-url-new-window-p, browse-url-netscape-display,
browse-url-save-file, browse-url-generic-program): Add autoload
cookie.
(browse-url-mosaic-program, browse-url-lynx-input-field,
browse-url-lynx-input-attempts, browse-url-lynx-input-delay): Add
:version.
(browse-url-of-file-hook): Add :options.
(browse-url-lynx-emacs-args): New option.
(browse-url-lynx-emacs): Use it.
(browse-url-lynx-xterm): Use backquote.
(browse-url-emacs-display): Use Emacs version, not XEmacs.
((require 'term)): When compiling.
| -rw-r--r-- | lisp/browse-url.el | 158 |
1 files changed, 81 insertions, 77 deletions
diff --git a/lisp/browse-url.el b/lisp/browse-url.el index 23ad63919f5..c429ac062cb 100644 --- a/lisp/browse-url.el +++ b/lisp/browse-url.el | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | ;;; browse-url.el --- Pass a URL to a WWW browser | 1 | ;;; browse-url.el --- Pass a URL to a WWW browser |
| 2 | 2 | ||
| 3 | ;; Copyright 1995, 1996, 1997 Free Software Foundation, Inc. | 3 | ;; Copyright 1995, 1996, 1997, 1998 Free Software Foundation, Inc. |
| 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 <fx@gnu.org> |
| 7 | ;; Created: 03 Apr 1995 | 7 | ;; Created: 03 Apr 1995 |
| 8 | ;; Keywords: hypertext, hypermedia, mouse | 8 | ;; Keywords: hypertext, hypermedia, mouse |
| 9 | 9 | ||
| @@ -26,9 +26,6 @@ | |||
| 26 | 26 | ||
| 27 | ;;; Commentary: | 27 | ;;; Commentary: |
| 28 | 28 | ||
| 29 | ;; The latest version of this package should be available from | ||
| 30 | ;; <URL:http://wombat.doc.ic.ac.uk/emacs/browse-url.el>. | ||
| 31 | |||
| 32 | ;; This package provides functions which read a URL (Uniform Resource | 29 | ;; This package provides functions which read a URL (Uniform Resource |
| 33 | ;; Locator) from the minibuffer, defaulting to the URL around point, | 30 | ;; Locator) from the minibuffer, defaulting to the URL around point, |
| 34 | ;; and ask a World-Wide Web browser to load it. It can also load the | 31 | ;; and ask a World-Wide Web browser to load it. It can also load the |
| @@ -38,7 +35,7 @@ | |||
| 38 | ;; is started. Currently there is support for: | 35 | ;; is started. Currently there is support for: |
| 39 | 36 | ||
| 40 | ;; Function Browser Earliest version | 37 | ;; Function Browser Earliest version |
| 41 | ;; browse-url-netscape Netscape 1.1b1 | 38 | ;; browse-url-netscape Netscape 1.1b1 |
| 42 | ;; browse-url-mosaic XMosaic/mMosaic <= 2.4 | 39 | ;; browse-url-mosaic XMosaic/mMosaic <= 2.4 |
| 43 | ;; browse-url-cci XMosaic 2.5 | 40 | ;; browse-url-cci XMosaic 2.5 |
| 44 | ;; browse-url-w3 w3 0 | 41 | ;; browse-url-w3 w3 0 |
| @@ -74,7 +71,7 @@ | |||
| 74 | ;; doesn't let you edit the URL like browse-url. | 71 | ;; doesn't let you edit the URL like browse-url. |
| 75 | ;; The `gnuserv' package that can be used to control it in another | 72 | ;; The `gnuserv' package that can be used to control it in another |
| 76 | ;; Emacs process is available from | 73 | ;; Emacs process is available from |
| 77 | ;; <URL:http://hplbwww.hpl.hp.com/people/ange/gnuserv/>. | 74 | ;; <URL:ftp://ftp.splode.com/pub/users/friedman/packages/>. |
| 78 | 75 | ||
| 79 | ;; Grail is the freely available WWW browser implemented in Python, a | 76 | ;; Grail is the freely available WWW browser implemented in Python, a |
| 80 | ;; cool object-oriented freely available interpreted language. Grail | 77 | ;; cool object-oriented freely available interpreted language. Grail |
| @@ -84,8 +81,8 @@ | |||
| 84 | ;; Python see <url:http://www.python.org/>. Grail support in | 81 | ;; Python see <url:http://www.python.org/>. Grail support in |
| 85 | ;; browse-url.el written by Barry Warsaw <bwarsaw@python.org>. | 82 | ;; browse-url.el written by Barry Warsaw <bwarsaw@python.org>. |
| 86 | 83 | ||
| 87 | ;; MMM is the freely available WWW browser implemented in Caml Special | 84 | ;; MMM is the freely available WWW browser implemented in Objective |
| 88 | ;; Light, a cool impure functional programming language, by Francois | 85 | ;; Caml, a cool impure functional programming language, by Francois |
| 89 | ;; Rouaix. See the MMM home page | 86 | ;; Rouaix. See the MMM home page |
| 90 | ;; <URL:http://pauillac.inria.fr/%7Erouaix/mmm/>. | 87 | ;; <URL:http://pauillac.inria.fr/%7Erouaix/mmm/>. |
| 91 | 88 | ||
| @@ -113,11 +110,9 @@ | |||
| 113 | ;; with this. | 110 | ;; with this. |
| 114 | 111 | ||
| 115 | ;; This package generalises function html-previewer-process in Marc | 112 | ;; This package generalises function html-previewer-process in Marc |
| 116 | ;; Andreessen <marca@ncsa.uiuc.edu>'s html-mode (LCD | 113 | ;; Andreessen's html-mode (LCD modes/html-mode.el.Z). See also the |
| 117 | ;; modes/html-mode.el.Z) and provides better versions of the URL | 114 | ;; ffap.el package. The huge hyperbole package also contains similar |
| 118 | ;; functions in Michelangelo Grigni <mic@cs.ucsd.edu>'s ffap.el | 115 | ;; functions. |
| 119 | ;; (find-file-at-point) <URL:ftp://cs.ucsd.edu:/pub/mic/>. The huge | ||
| 120 | ;; hyperbole package also contains similar functions. | ||
| 121 | 116 | ||
| 122 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 117 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 123 | ;; Help! | 118 | ;; Help! |
| @@ -219,12 +214,13 @@ | |||
| 219 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 214 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 220 | ;;; Code: | 215 | ;;; Code: |
| 221 | 216 | ||
| 222 | (eval-when-compile (require 'dired) | ||
| 223 | (require 'thingatpt)) | ||
| 224 | |||
| 225 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 217 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 226 | ;; Variables | 218 | ;; Variables |
| 227 | 219 | ||
| 220 | (eval-when-compile (require 'dired) | ||
| 221 | (require 'thingatpt) | ||
| 222 | (require 'term)) | ||
| 223 | |||
| 228 | (defgroup browse-url nil | 224 | (defgroup browse-url nil |
| 229 | "Use a web browser to look at a URL." | 225 | "Use a web browser to look at a URL." |
| 230 | :prefix "browse-url-" | 226 | :prefix "browse-url-" |
| @@ -238,7 +234,7 @@ This is used by the `browse-url-at-point', `browse-url-at-mouse', and | |||
| 238 | `browse-url-of-file' commands. | 234 | `browse-url-of-file' commands. |
| 239 | 235 | ||
| 240 | If the value is not a function it should be a list of pairs | 236 | If the value is not a function it should be a list of pairs |
| 241 | (REGEXP.FUNCTION). In this case the function called will be the one | 237 | (REGEXP . FUNCTION). In this case the function called will be the one |
| 242 | associated with the first REGEXP which matches the current URL. The | 238 | associated with the first REGEXP which matches the current URL. The |
| 243 | function is passed the URL and any other args of `browse-url'. The last | 239 | function is passed the URL and any other args of `browse-url'. The last |
| 244 | regexp should probably be \".\" to specify a default browser." | 240 | regexp should probably be \".\" to specify a default browser." |
| @@ -263,7 +259,7 @@ regexp should probably be \".\" to specify a default browser." | |||
| 263 | 259 | ||
| 264 | (defcustom browse-url-netscape-program "netscape" | 260 | (defcustom browse-url-netscape-program "netscape" |
| 265 | ;; Info about netscape-remote from Kurt Swanson in gnu.emacs.gnus | 261 | ;; Info about netscape-remote from Kurt Swanson in gnu.emacs.gnus |
| 266 | "*The name by which to invoke Netscape. | 262 | "The name by which to invoke Netscape. |
| 267 | 263 | ||
| 268 | It is said that source is available for a program `netscape-remote' | 264 | 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 | 265 | which starts up very much quicker than `netscape' and that it is |
| @@ -276,17 +272,18 @@ program like: | |||
| 276 | :group 'browse-url) | 272 | :group 'browse-url) |
| 277 | 273 | ||
| 278 | (defcustom browse-url-netscape-arguments nil | 274 | (defcustom browse-url-netscape-arguments nil |
| 279 | "*A list of strings to pass to Netscape as arguments." | 275 | "A list of strings to pass to Netscape as arguments." |
| 280 | :type '(repeat (string :tag "Argument")) | 276 | :type '(repeat (string :tag "Argument")) |
| 281 | :group 'browse-url) | 277 | :group 'browse-url) |
| 282 | 278 | ||
| 283 | (defcustom browse-url-netscape-startup-arguments browse-url-netscape-arguments | 279 | (defcustom browse-url-netscape-startup-arguments browse-url-netscape-arguments |
| 284 | "*A list of strings to pass to Netscape when it start up. | 280 | "A list of strings to pass to Netscape when it starts up. |
| 285 | Defaults to the value of `browse-url-netscape-arguments' at the time | 281 | Defaults to the value of `browse-url-netscape-arguments' at the time |
| 286 | `browse-url' is loaded." | 282 | `browse-url' is loaded." |
| 287 | :type '(repeat (string :tag "Argument")) | 283 | :type '(repeat (string :tag "Argument")) |
| 288 | :group 'browse-url) | 284 | :group 'browse-url) |
| 289 | 285 | ||
| 286 | ;;;###autoload | ||
| 290 | (defcustom browse-url-new-window-p nil | 287 | (defcustom browse-url-new-window-p nil |
| 291 | "*If non-nil, always open a new browser window with appropriate browsers. | 288 | "*If non-nil, always open a new browser window with appropriate browsers. |
| 292 | Passing an interactive argument to \\[browse-url], or specific browser | 289 | Passing an interactive argument to \\[browse-url], or specific browser |
| @@ -295,18 +292,20 @@ commands reverses the effect of this variable. Requires Netscape version | |||
| 295 | :type 'boolean | 292 | :type 'boolean |
| 296 | :group 'browse-url) | 293 | :group 'browse-url) |
| 297 | 294 | ||
| 295 | ;;;###autoload | ||
| 298 | (defcustom browse-url-netscape-display nil | 296 | (defcustom browse-url-netscape-display nil |
| 299 | "*The X display for running Netscape, if not same as Emacs'." | 297 | "*The X display for running Netscape, if not same as Emacs'." |
| 300 | :type '(choice string (const :tag "Default" nil)) | 298 | :type '(choice string (const :tag "Default" nil)) |
| 301 | :group 'browse-url) | 299 | :group 'browse-url) |
| 302 | 300 | ||
| 303 | (defcustom browse-url-mosaic-program "xmosaic" | 301 | (defcustom browse-url-mosaic-program "xmosaic" |
| 304 | "*The name by which to invoke Mosaic (or mMosaic)." | 302 | "The name by which to invoke Mosaic (or mMosaic)." |
| 305 | :type 'string | 303 | :type 'string |
| 304 | :version "20.3" | ||
| 306 | :group 'browse-url) | 305 | :group 'browse-url) |
| 307 | 306 | ||
| 308 | (defcustom browse-url-mosaic-arguments nil | 307 | (defcustom browse-url-mosaic-arguments nil |
| 309 | "*A list of strings to pass to Mosaic as arguments." | 308 | "A list of strings to pass to Mosaic as arguments." |
| 310 | :type '(repeat (string :tag "Argument")) | 309 | :type '(repeat (string :tag "Argument")) |
| 311 | :group 'browse-url) | 310 | :group 'browse-url) |
| 312 | 311 | ||
| @@ -317,7 +316,7 @@ commands reverses the effect of this variable. Requires Netscape version | |||
| 317 | ;; applies. | 316 | ;; applies. |
| 318 | ("^/\\([^:@]+@\\)?\\([^:]+\\):/*" . "ftp://\\1\\2/") | 317 | ("^/\\([^:@]+@\\)?\\([^:]+\\):/*" . "ftp://\\1\\2/") |
| 319 | ("^/+" . "file:/")) | 318 | ("^/+" . "file:/")) |
| 320 | "*An alist of (REGEXP . STRING) pairs used by `browse-url-of-file'. | 319 | "An alist of (REGEXP . STRING) pairs used by `browse-url-of-file'. |
| 321 | Any substring of a filename matching one of the REGEXPs is replaced by | 320 | Any substring of a filename matching one of the REGEXPs is replaced by |
| 322 | the corresponding STRING using `replace-match', not treating STRING | 321 | the corresponding STRING using `replace-match', not treating STRING |
| 323 | literally. All pairs are applied in the order given. The default | 322 | literally. All pairs are applied in the order given. The default |
| @@ -340,6 +339,7 @@ address to an HTTP URL: | |||
| 340 | :version "20.3" | 339 | :version "20.3" |
| 341 | :group 'browse-url) | 340 | :group 'browse-url) |
| 342 | 341 | ||
| 342 | ;;;###autoload | ||
| 343 | (defcustom browse-url-save-file nil | 343 | (defcustom browse-url-save-file nil |
| 344 | "*If non-nil, save the buffer before displaying its file. | 344 | "*If non-nil, save the buffer before displaying its file. |
| 345 | Used by the `browse-url-of-file' command." | 345 | Used by the `browse-url-of-file' command." |
| @@ -347,11 +347,12 @@ Used by the `browse-url-of-file' command." | |||
| 347 | :group 'browse-url) | 347 | :group 'browse-url) |
| 348 | 348 | ||
| 349 | (defcustom browse-url-of-file-hook nil | 349 | (defcustom browse-url-of-file-hook nil |
| 350 | "*Run after `browse-url-of-file' has asked a browser to load a file. | 350 | "Run after `browse-url-of-file' has asked a browser to load a file. |
| 351 | 351 | ||
| 352 | Set this to `browse-url-netscape-reload' to force Netscape to load the | 352 | Set this to `browse-url-netscape-reload' to force Netscape to load the |
| 353 | file rather than displaying a cached copy." | 353 | file rather than displaying a cached copy." |
| 354 | :type 'hook | 354 | :type 'hook |
| 355 | :options '(browse-url-netscape-reload) | ||
| 355 | :group 'browse-url) | 356 | :group 'browse-url) |
| 356 | 357 | ||
| 357 | (defvar browse-url-usr1-signal | 358 | (defvar browse-url-usr1-signal |
| @@ -364,7 +365,7 @@ Emacs 19.29 accepts 'SIGUSR1, earlier versions require an integer | |||
| 364 | which is 30 on SunOS and 16 on HP-UX and Solaris.") | 365 | which is 30 on SunOS and 16 on HP-UX and Solaris.") |
| 365 | 366 | ||
| 366 | (defcustom browse-url-CCI-port 3003 | 367 | (defcustom browse-url-CCI-port 3003 |
| 367 | "*Port to access XMosaic via CCI. | 368 | "Port to access XMosaic via CCI. |
| 368 | This can be any number between 1024 and 65535 but must correspond to | 369 | This can be any number between 1024 and 65535 but must correspond to |
| 369 | the value set in the browser." | 370 | the value set in the browser." |
| 370 | :type 'integer | 371 | :type 'integer |
| @@ -381,7 +382,7 @@ enabled. The port number should be set in `browse-url-CCI-port'." | |||
| 381 | (make-variable-buffer-local 'browse-url-temp-file-name) | 382 | (make-variable-buffer-local 'browse-url-temp-file-name) |
| 382 | 383 | ||
| 383 | (defcustom browse-url-xterm-program "xterm" | 384 | (defcustom browse-url-xterm-program "xterm" |
| 384 | "*The name of the terminal emulator used by `browse-url-lynx-xterm'. | 385 | "The name of the terminal emulator used by `browse-url-lynx-xterm'. |
| 385 | This might, for instance, be a separate colour version of xterm." | 386 | This might, for instance, be a separate colour version of xterm." |
| 386 | :type 'string | 387 | :type 'string |
| 387 | :group 'browse-url) | 388 | :group 'browse-url) |
| @@ -392,8 +393,19 @@ These might set its size, for instance." | |||
| 392 | :type '(repeat (string :tag "Argument")) | 393 | :type '(repeat (string :tag "Argument")) |
| 393 | :group 'browse-url) | 394 | :group 'browse-url) |
| 394 | 395 | ||
| 396 | (defcustom browse-url-lynx-emacs-args (and (not window-system) | ||
| 397 | '("-show_cursor")) | ||
| 398 | "A list of strings defining options for Lynx in an Emacs buffer. | ||
| 399 | |||
| 400 | The default is none in a window system, otherwise `-show_cursor' to | ||
| 401 | indicate the position of the current link in the absence of | ||
| 402 | highlighting, assuming the normal default for showing the cursor." | ||
| 403 | :type '(repeat (string :tag "Argument")) | ||
| 404 | :version "20.3" | ||
| 405 | :group 'browse-url) | ||
| 406 | |||
| 395 | (defcustom browse-url-gnudoit-program "gnudoit" | 407 | (defcustom browse-url-gnudoit-program "gnudoit" |
| 396 | "*The name of the `gnudoit' program used by `browse-url-w3-gnudoit'." | 408 | "The name of the `gnudoit' program used by `browse-url-w3-gnudoit'." |
| 397 | :type 'string | 409 | :type 'string |
| 398 | :group 'browse-url) | 410 | :group 'browse-url) |
| 399 | 411 | ||
| @@ -403,6 +415,7 @@ These might set the port, for instance." | |||
| 403 | :type '(repeat (string :tag "Argument")) | 415 | :type '(repeat (string :tag "Argument")) |
| 404 | :group 'browse-url) | 416 | :group 'browse-url) |
| 405 | 417 | ||
| 418 | ;;;###autoload | ||
| 406 | (defcustom browse-url-generic-program nil | 419 | (defcustom browse-url-generic-program nil |
| 407 | "*The name of the browser program used by `browse-url-generic'." | 420 | "*The name of the browser program used by `browse-url-generic'." |
| 408 | :type '(choice string (const :tag "None" nil)) | 421 | :type '(choice string (const :tag "None" nil)) |
| @@ -415,7 +428,7 @@ These might set the port, for instance." | |||
| 415 | 428 | ||
| 416 | (defcustom browse-url-temp-dir | 429 | (defcustom browse-url-temp-dir |
| 417 | (or (getenv "TMPDIR") "/tmp") | 430 | (or (getenv "TMPDIR") "/tmp") |
| 418 | "*The name of a directory for browse-url's temporary files. | 431 | "The name of a directory for browse-url's temporary files. |
| 419 | Such files are generated by functions like `browse-url-of-region'. | 432 | Such files are generated by functions like `browse-url-of-region'. |
| 420 | You might want to set this to somewhere with restricted read permissions | 433 | You might want to set this to somewhere with restricted read permissions |
| 421 | for privacy's sake." | 434 | for privacy's sake." |
| @@ -424,7 +437,7 @@ for privacy's sake." | |||
| 424 | 437 | ||
| 425 | (defcustom browse-url-netscape-version | 438 | (defcustom browse-url-netscape-version |
| 426 | 3 | 439 | 3 |
| 427 | "*The version of Netscape you are using. | 440 | "The version of Netscape you are using. |
| 428 | This affects how URL reloading is done; the mechanism changed | 441 | This affects how URL reloading is done; the mechanism changed |
| 429 | incompatibly at version 4." | 442 | incompatibly at version 4." |
| 430 | :type 'number | 443 | :type 'number |
| @@ -441,15 +454,18 @@ down (this *won't* always work)." | |||
| 441 | :type '(choice (const :tag "Move to try to avoid field" :value avoid) | 454 | :type '(choice (const :tag "Move to try to avoid field" :value avoid) |
| 442 | (const :tag "Disregard" :value nil) | 455 | (const :tag "Disregard" :value nil) |
| 443 | (const :tag "Warn, don't emit URL" :value warn)) | 456 | (const :tag "Warn, don't emit URL" :value warn)) |
| 457 | :version "20.3" | ||
| 444 | :group 'browse-url) | 458 | :group 'browse-url) |
| 445 | 459 | ||
| 446 | (defcustom browse-url-lynx-input-attempts 10 | 460 | (defcustom browse-url-lynx-input-attempts 10 |
| 447 | "*How many times to try to move down from a series of lynx input fields." | 461 | "*How many times to try to move down from a series of lynx input fields." |
| 462 | :version "20.3" | ||
| 448 | :type 'integer | 463 | :type 'integer |
| 449 | :group 'browse-url) | 464 | :group 'browse-url) |
| 450 | 465 | ||
| 451 | (defcustom browse-url-lynx-input-delay 0.2 | 466 | (defcustom browse-url-lynx-input-delay 0.2 |
| 452 | "*How many seconds to wait for lynx between moves down from an input field." | 467 | "How many seconds to wait for lynx between moves down from an input field." |
| 468 | :version "20.3" | ||
| 453 | :type 'number | 469 | :type 'number |
| 454 | :group 'browse-url) | 470 | :group 'browse-url) |
| 455 | 471 | ||
| @@ -599,29 +615,20 @@ narrowed." | |||
| 599 | ;; A generic command to call the current browse-url-browser-function | 615 | ;; A generic command to call the current browse-url-browser-function |
| 600 | 616 | ||
| 601 | ;;;###autoload | 617 | ;;;###autoload |
| 602 | (defun browse-url (&rest args) | 618 | (defun browse-url (url &rest args) |
| 603 | "Ask a WWW browser to load URL. | 619 | "Ask a WWW browser to load URL. |
| 604 | Prompts for a URL, defaulting to the URL at or before point. Variable | 620 | Prompts for a URL, defaulting to the URL at or before point. Variable |
| 605 | `browse-url-browser-function' says which browser to use." | 621 | `browse-url-browser-function' says which browser to use." |
| 606 | (interactive (browse-url-interactive-arg "URL: ")) | 622 | (interactive (browse-url-interactive-arg "URL: ")) |
| 607 | (if (consp browse-url-browser-function) | 623 | (let ((bf browse-url-browser-function) re) |
| 608 | (apply 'browse-url-choose-browser args) | 624 | (while (consp bf) |
| 609 | (apply browse-url-browser-function args))) | 625 | (setq re (car (car bf)) |
| 610 | 626 | bf (if (string-match re url) | |
| 611 | (defun browse-url-choose-browser (url &rest args) | 627 | (cdr (car bf)) ; The function |
| 612 | "Pass URL to a browser function chosen. | 628 | (cdr bf)))) ; More pairs |
| 613 | This is done according to the association list in variable | 629 | (or bf (error "No browser in browse-url-browser-function matching URL %s" |
| 614 | `browse-url-browser-function'." | 630 | url)) |
| 615 | (let ((blist browse-url-browser-function) | 631 | (apply bf url args))) |
| 616 | re bf) | ||
| 617 | (while (consp blist) | ||
| 618 | (setq re (car (car blist)) | ||
| 619 | bf (cdr (car blist)) | ||
| 620 | blist (cdr blist)) | ||
| 621 | (if (string-match re url) | ||
| 622 | (progn (apply bf url args) (setq blist t)))) | ||
| 623 | (or blist | ||
| 624 | (error "No browser in browse-url-browser-function matching URL %s" url)))) | ||
| 625 | 632 | ||
| 626 | ;;;###autoload | 633 | ;;;###autoload |
| 627 | (defun browse-url-at-point () | 634 | (defun browse-url-at-point () |
| @@ -672,17 +679,11 @@ environment, otherwise just use the current environment." | |||
| 672 | "Return the X display Emacs is running on. | 679 | "Return the X display Emacs is running on. |
| 673 | This is nil if the display is the same as the DISPLAY environment variable. | 680 | This is nil if the display is the same as the DISPLAY environment variable. |
| 674 | 681 | ||
| 675 | Actually Emacs could be using several screens on several displays, as | 682 | Actually Emacs could be using several displays; this just returns the |
| 676 | listed by (emacs-display-list) and (x-display-screens DISPLAY), this | 683 | one showing the selected frame." |
| 677 | just returns the display showing the selected frame. You got a | 684 | (let ((display (cdr-safe (assq 'display (frame-parameters))))) |
| 678 | problem with that?" | 685 | (and (not (equal display (getenv "DISPLAY"))) |
| 679 | (let (device display) | 686 | display))) |
| 680 | (and (fboundp 'selected-device) (fboundp 'device-type) (fboundp 'device-connection) | ||
| 681 | (setq device (selected-device)) | ||
| 682 | (eq (device-type device) 'x) | ||
| 683 | (setq display (device-connection device)) | ||
| 684 | (not (equal display (getenv "DISPLAY"))) | ||
| 685 | display))) | ||
| 686 | 687 | ||
| 687 | ;;;###autoload | 688 | ;;;###autoload |
| 688 | (defun browse-url-netscape (url &optional new-window) | 689 | (defun browse-url-netscape (url &optional new-window) |
| @@ -710,8 +711,8 @@ used instead of `browse-url-new-window-p'." | |||
| 710 | (if (eq window-system 'w32) | 711 | (if (eq window-system 'w32) |
| 711 | (list url) | 712 | (list url) |
| 712 | (if new-window '("-noraise")) | 713 | (if new-window '("-noraise")) |
| 713 | (list "-remote" | 714 | (list "-remote" |
| 714 | (concat "openURL(" url | 715 | (concat "openURL(" url |
| 715 | (if (browse-url-maybe-new-window | 716 | (if (browse-url-maybe-new-window |
| 716 | new-window) | 717 | new-window) |
| 717 | ",new-window") | 718 | ",new-window") |
| @@ -804,7 +805,7 @@ used instead of `browse-url-new-window-p'." | |||
| 804 | ;;;###autoload | 805 | ;;;###autoload |
| 805 | (defvar browse-url-grail | 806 | (defvar browse-url-grail |
| 806 | (concat (or (getenv "GRAILDIR") "~/.grail") "/user/rcgrail.py") | 807 | (concat (or (getenv "GRAILDIR") "~/.grail") "/user/rcgrail.py") |
| 807 | "*Location of Grail remote control client script `rcgrail.py'. | 808 | "Location of Grail remote control client script `rcgrail.py'. |
| 808 | Typically found in $GRAILDIR/rcgrail.py, or ~/.grail/user/rcgrail.py.") | 809 | Typically found in $GRAILDIR/rcgrail.py, or ~/.grail/user/rcgrail.py.") |
| 809 | 810 | ||
| 810 | ;;;###autoload | 811 | ;;;###autoload |
| @@ -902,8 +903,8 @@ Default to the URL around or before point. A new Lynx process is run | |||
| 902 | in an Xterm window using the Xterm program named by `browse-url-xterm-program' | 903 | in an Xterm window using the Xterm program named by `browse-url-xterm-program' |
| 903 | with possible additional arguments `browse-url-xterm-args'." | 904 | with possible additional arguments `browse-url-xterm-args'." |
| 904 | (interactive (browse-url-interactive-arg "Lynx URL: ")) | 905 | (interactive (browse-url-interactive-arg "Lynx URL: ")) |
| 905 | (apply 'start-process (concat "lynx" url) nil browse-url-xterm-program | 906 | (apply #'start-process `(,(concat "lynx" url) nil ,browse-url-xterm-program |
| 906 | (append browse-url-xterm-args (list "-e" "lynx" url)))) | 907 | ,@browse-url-xterm-args "-e" "lynx" ,url))) |
| 907 | 908 | ||
| 908 | ;; --- Lynx in an Emacs "term" window --- | 909 | ;; --- Lynx in an Emacs "term" window --- |
| 909 | 910 | ||
| @@ -937,17 +938,20 @@ used instead of `browse-url-new-window-p'." | |||
| 937 | (not proc) | 938 | (not proc) |
| 938 | (not (memq (process-status proc) '(run stop)))) | 939 | (not (memq (process-status proc) '(run stop)))) |
| 939 | ;; start a new lynx | 940 | ;; start a new lynx |
| 940 | (progn (setq buf (make-term "lynx" "lynx" nil url)) | 941 | (progn |
| 941 | (switch-to-buffer buf) | 942 | (setq buf |
| 942 | (term-char-mode) | 943 | (apply #'make-term |
| 943 | (set-process-sentinel | 944 | `("lynx" "lynx" nil ,@browse-url-lynx-emacs-args ,url))) |
| 944 | (get-buffer-process buf) | 945 | (switch-to-buffer buf) |
| 945 | ;; Don't leave around a dead one (especially because | 946 | (term-char-mode) |
| 946 | ;; of its munged keymap.) | 947 | (set-process-sentinel |
| 947 | (lambda (process event) | 948 | (get-buffer-process buf) |
| 948 | (if (not (memq (process-status process) '(run stop))) | 949 | ;; Don't leave around a dead one (especially because of its |
| 949 | (let ((buf (process-buffer process))) | 950 | ;; munged keymap.) |
| 950 | (if buf (kill-buffer buf))))))) | 951 | (lambda (process event) |
| 952 | (if (not (memq (process-status process) '(run stop))) | ||
| 953 | (let ((buf (process-buffer process))) | ||
| 954 | (if buf (kill-buffer buf))))))) | ||
| 951 | ;; send the url to lynx in the old buffer | 955 | ;; send the url to lynx in the old buffer |
| 952 | (let ((win (get-buffer-window buf t))) | 956 | (let ((win (get-buffer-window buf t))) |
| 953 | (if win | 957 | (if win |