Mercurial > emacs
annotate lisp/browse-url.el @ 24419:30e478cd167e
(shell-command-default-error-buffer): Renamed from
shell-command-on-region-default-error-buffer.
(shell-command-on-region): Mention in echo area when there
is some error output. Mention success or failure, too.
Accumulate multiple error outputs
going forward, with formfeed in between. Display the error buffer
when we have put something in it.
(shell-command): Add the ERROR-BUFFER argument feature.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Mon, 01 Mar 1999 03:19:32 +0000 |
parents | c2b622202522 |
children | fd669611d301 |
rev | line source |
---|---|
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1 ;;; browse-url.el --- Pass a URL to a WWW browser |
14169 | 2 |
24063
2dde27ae5540
(browse-url-netscape): Fix ineffective "-noraise".
Dave Love <fx@gnu.org>
parents:
24010
diff
changeset
|
3 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. |
13208 | 4 |
5 ;; Author: Denis Howe <dbh@doc.ic.ac.uk> | |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
6 ;; Maintainer: Dave Love <fx@gnu.org> |
13208 | 7 ;; Created: 03 Apr 1995 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
8 ;; Keywords: hypertext, hypermedia, mouse |
13208 | 9 |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14169 | 13 ;; it under the terms of the GNU General Public License as published by |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
13208 | 16 |
14169 | 17 ;; GNU Emacs is distributed in the hope that it will be useful, |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
13208 | 21 |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
14169 | 24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
25 ;; Boston, MA 02111-1307, USA. | |
13208 | 26 |
27 ;;; Commentary: | |
28 | |
29 ;; This package provides functions which read a URL (Uniform Resource | |
30 ;; Locator) from the minibuffer, defaulting to the URL around point, | |
31 ;; and ask a World-Wide Web browser to load it. It can also load the | |
32 ;; URL associated with the current buffer. Different browsers use | |
33 ;; different methods of remote control so there is one function for | |
34 ;; each supported browser. If the chosen browser is not running, it | |
35 ;; is started. Currently there is support for: | |
36 | |
37 ;; Function Browser Earliest version | |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
38 ;; browse-url-netscape Netscape 1.1b1 |
20167 | 39 ;; browse-url-mosaic XMosaic/mMosaic <= 2.4 |
13208 | 40 ;; browse-url-cci XMosaic 2.5 |
41 ;; browse-url-w3 w3 0 | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
42 ;; browse-url-w3-gnudoit w3 remotely |
13208 | 43 ;; browse-url-iximosaic IXI Mosaic ? |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
44 ;; browse-url-lynx-* Lynx 0 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
45 ;; browse-url-grail Grail 0.3b1 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
46 ;; browse-url-mmm MMM ? |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
47 ;; browse-url-generic arbitrary |
13208 | 48 |
22507
f189183483a2
(browse-url-netscape): Encode `)' too.
Dave Love <fx@gnu.org>
parents:
22425
diff
changeset
|
49 ;; [The Netscape browser is now free software |
f189183483a2
(browse-url-netscape): Encode `)' too.
Dave Love <fx@gnu.org>
parents:
22425
diff
changeset
|
50 ;; <URL:http://www.mozilla.org/>, albeit not GPLed, so it is |
f189183483a2
(browse-url-netscape): Encode `)' too.
Dave Love <fx@gnu.org>
parents:
22425
diff
changeset
|
51 ;; reasonable to keep it as the default.] |
f189183483a2
(browse-url-netscape): Encode `)' too.
Dave Love <fx@gnu.org>
parents:
22425
diff
changeset
|
52 |
13208 | 53 ;; Note that versions of Netscape before 1.1b1 did not have remote |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
54 ;; control. <URL:http://www.netscape.com/newsref/std/x-remote.html>. |
13208 | 55 |
22507
f189183483a2
(browse-url-netscape): Encode `)' too.
Dave Love <fx@gnu.org>
parents:
22425
diff
changeset
|
56 ;; Browsers can cache Web pages so it may be necessary to tell them to |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
57 ;; reload the current page if it has changed (e.g. if you have edited |
13208 | 58 ;; it). There is currently no perfect automatic solution to this. |
59 | |
60 ;; Netscape allows you to specify the id of the window you want to | |
61 ;; control but which window DO you want to control and how do you | |
62 ;; discover its id? | |
63 | |
64 ;; If using XMosaic before version 2.5, check the definition of | |
65 ;; browse-url-usr1-signal below. | |
66 ;; <URL:http://www.ncsa.uiuc.edu/SDG/Software/XMosaic/remote-control.html> | |
67 | |
68 ;; XMosaic version 2.5 introduced Common Client Interface allowing you | |
69 ;; to control mosaic through Unix sockets. | |
70 ;; <URL:http://www.ncsa.uiuc.edu/SDG/Software/XMosaic/CCI/cci-spec.html> | |
71 | |
72 ;; William M. Perry's excellent "w3" WWW browser for | |
73 ;; Emacs <URL:ftp://cs.indiana.edu/pub/elisp/w3/> | |
74 ;; has a function w3-follow-url-at-point, but that | |
75 ;; doesn't let you edit the URL like browse-url. | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
76 ;; The `gnuserv' package that can be used to control it in another |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
77 ;; Emacs process is available from |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
78 ;; <URL:ftp://ftp.splode.com/pub/users/friedman/packages/>. |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
79 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
80 ;; Grail is the freely available WWW browser implemented in Python, a |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
81 ;; cool object-oriented freely available interpreted language. Grail |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
82 ;; 0.3b1 was the first version to have remote control as distributed. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
83 ;; For more information on Grail see |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
84 ;; <URL:http://grail.cnri.reston.va.us/> and for more information on |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
85 ;; Python see <url:http://www.python.org/>. Grail support in |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
86 ;; browse-url.el written by Barry Warsaw <bwarsaw@python.org>. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
87 |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
88 ;; MMM is the freely available WWW browser implemented in Objective |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
89 ;; Caml, a cool impure functional programming language, by Francois |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
90 ;; Rouaix. See the MMM home page |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
91 ;; <URL:http://pauillac.inria.fr/%7Erouaix/mmm/>. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
92 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
93 ;; Lynx is now distributed by the FSF. See also |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
94 ;; <URL:http://lynx.browser.org/>. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
95 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
96 ;; Free graphical browsers that could be used by `browse-url-generic' |
19442 | 97 ;; include Chimera <URL:ftp://ftp.cs.unlv.edu/pub/chimera> and |
98 ;; <URL:http://www.unlv.edu/chimera/>, Arena | |
20167 | 99 ;; <URL:ftp://ftp.yggdrasil.com/pub/dist/web/arena> and Amaya |
100 ;; <URL:ftp://ftp.w3.org/pub/amaya>. mMosaic | |
101 ;; <URL:ftp://sig.enst.fr/pub/multicast/mMosaic/> (with development | |
102 ;; support for Java applets and multicast) can be used like Mosaic by | |
103 ;; setting `browse-url-mosaic-program' appropriately. | |
13208 | 104 |
22507
f189183483a2
(browse-url-netscape): Encode `)' too.
Dave Love <fx@gnu.org>
parents:
22425
diff
changeset
|
105 ;; I [Denis Howe, not Dave Love] recommend Nelson Minar |
f189183483a2
(browse-url-netscape): Encode `)' too.
Dave Love <fx@gnu.org>
parents:
22425
diff
changeset
|
106 ;; <nelson@santafe.edu>'s excellent html-helper-mode.el for editing |
f189183483a2
(browse-url-netscape): Encode `)' too.
Dave Love <fx@gnu.org>
parents:
22425
diff
changeset
|
107 ;; HTML and thank Nelson for his many useful comments on this code. |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
108 ;; <URL:http://www.santafe.edu/%7Enelson/hhm-beta/> |
13208 | 109 |
19583
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
110 ;; See also hm--html-menus <URL:http://www.tnt.uni-hannover.de/%7Emuenkel/ |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
111 ;; software/own/hm--html-menus/>. For composing correct HTML see also |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
112 ;; PSGML the general SGML structure editor package |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
113 ;; <URL:ftp://ftp.lysator.liu.se/pub/sgml>; hm--html-menus can be used |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
114 ;; with this. |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
115 |
13208 | 116 ;; This package generalises function html-previewer-process in Marc |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
117 ;; Andreessen's html-mode (LCD modes/html-mode.el.Z). See also the |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
118 ;; ffap.el package. The huge hyperbole package also contains similar |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
119 ;; functions. |
13208 | 120 |
121 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
122 ;; Help! | |
123 | |
124 ;; Can you write and test some code for the Macintrash and Windoze | |
125 ;; Netscape remote control APIs? (See the URL above). | |
126 | |
127 ;; Do any other browsers have remote control? | |
128 | |
129 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
130 ;; Usage | |
131 | |
132 ;; To display the URL at or before point: | |
133 ;; M-x browse-url-at-point RET | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
134 ;; or, similarly but with the opportunity to edit the URL extracted from |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
135 ;; the buffer, use: |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
136 ;; M-x browse-url |
13208 | 137 |
138 ;; To display a URL by shift-clicking on it, put this in your ~/.emacs | |
139 ;; file: | |
13933
efd6ce432dc5
(browse-url-mosaic): Print "done" message
Richard M. Stallman <rms@gnu.org>
parents:
13224
diff
changeset
|
140 ;; (global-set-key [S-mouse-2] 'browse-url-at-mouse) |
efd6ce432dc5
(browse-url-mosaic): Print "done" message
Richard M. Stallman <rms@gnu.org>
parents:
13224
diff
changeset
|
141 ;; (Note that using Shift-mouse-1 is not desirable because |
efd6ce432dc5
(browse-url-mosaic): Print "done" message
Richard M. Stallman <rms@gnu.org>
parents:
13224
diff
changeset
|
142 ;; that event has a standard meaning in Emacs.) |
13208 | 143 |
144 ;; To display the current buffer in a web browser: | |
145 ;; M-x browse-url-of-buffer RET | |
146 | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
147 ;; To display the current region in a web browser: |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
148 ;; M-x browse-url-of-region RET |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
149 |
13208 | 150 ;; In Dired, to display the file named on the current line: |
151 ;; M-x browse-url-of-dired-file RET | |
152 | |
153 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
154 ;; Customisation (~/.emacs) | |
155 | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
156 ;; To see what variables are available for customization, type |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
157 ;; `M-x set-variable browse-url TAB'. Better, use |
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
158 ;; `M-x customize-group browse-url'. |
13208 | 159 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
160 ;; Bind the browse-url commands to keys with the `C-c C-z' prefix |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
161 ;; (as used by html-helper-mode): |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
162 ;; (global-set-key "\C-c\C-z." 'browse-url-at-point) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
163 ;; (global-set-key "\C-c\C-zb" 'browse-url-of-buffer) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
164 ;; (global-set-key "\C-c\C-zr" 'browse-url-of-region) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
165 ;; (global-set-key "\C-c\C-zu" 'browse-url) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
166 ;; (global-set-key "\C-c\C-zv" 'browse-url-of-file) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
167 ;; (add-hook 'dired-mode-hook |
20460
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
168 ;; (lambda () |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
169 ;; (local-set-key "\C-c\C-zf" 'browse-url-of-dired-file))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
170 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
171 ;; Browse URLs in mail messages by clicking mouse-2: |
20460
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
172 ;; (add-hook 'rmail-mode-hook (lambda () ; rmail-mode startup |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
173 ;; (define-key rmail-mode-map [mouse-2] 'browse-url-at-mouse))) |
13208 | 174 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
175 ;; Browse URLs in Usenet messages by clicking mouse-2: |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
176 ;; (eval-after-load "gnus" |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
177 ;; '(define-key gnus-article-mode-map [mouse-2] 'browse-url-at-mouse)) |
19583
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
178 ;; [The current version of Gnus provides a standard feature to |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
179 ;; activate URLs in article buffers for invocation of browse-url with |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
180 ;; mouse-2.] |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
181 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
182 ;; Use the Emacs w3 browser when not running under X11: |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
183 ;; (or (eq window-system 'x) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
184 ;; (setq browse-url-browser-function 'browse-url-w3)) |
13208 | 185 |
186 ;; To always save modified buffers before displaying the file in a browser: | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
187 ;; (setq browse-url-save-file t) |
13208 | 188 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
189 ;; To get round the Netscape caching problem, you could EITHER have |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
190 ;; write-file in html-helper-mode make Netscape reload the document: |
13208 | 191 ;; |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
192 ;; (autoload 'browse-url-netscape-reload "browse-url" |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
193 ;; "Ask a WWW browser to redisplay the current file." t) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
194 ;; (add-hook 'html-helper-mode-hook |
20460
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
195 ;; (lambda () |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
196 ;; (add-hook 'local-write-file-hooks |
20460
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
197 ;; (lambda () |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
198 ;; (let ((local-write-file-hooks)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
199 ;; (save-buffer)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
200 ;; (browse-url-netscape-reload) |
20460
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
201 ;; t) ; => file written by hook |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
202 ;; t))) ; append to l-w-f-hooks |
13208 | 203 ;; |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
204 ;; OR have browse-url-of-file ask Netscape to load and then reload the |
13208 | 205 ;; file: |
206 ;; | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
207 ;; (add-hook 'browse-url-of-file-hook 'browse-url-netscape-reload) |
13208 | 208 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
209 ;; You may also want to customise browse-url-netscape-arguments, e.g. |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
210 ;; (setq browse-url-netscape-arguments '("-install")) |
13208 | 211 ;; |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
212 ;; or similarly for the other browsers. |
13208 | 213 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
214 ;; To invoke different browsers for different URLs: |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
215 ;; (setq browse-url-browser-function '(("^mailto:" . browse-url-mail) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
216 ;; ("." . browse-url-netscape))) |
13208 | 217 |
218 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
219 ;;; Code: | |
220 | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
221 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
222 ;; Variables |
13208 | 223 |
22425
b235f1b173f3
Don't require dired when compiling.
Dave Love <fx@gnu.org>
parents:
22097
diff
changeset
|
224 (eval-when-compile (require 'thingatpt) |
24010 | 225 (require 'term) |
226 (require 'w3-auto nil t)) | |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
227 |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
228 (defgroup browse-url nil |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
229 "Use a web browser to look at a URL." |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
230 :prefix "browse-url-" |
19579
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
231 :group 'hypermedia) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
232 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
233 ;;;###autoload |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
234 (defcustom browse-url-browser-function |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
235 'browse-url-netscape |
13208 | 236 "*Function to display the current buffer in a WWW browser. |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
237 This is used by the `browse-url-at-point', `browse-url-at-mouse', and |
17456
b386f1a9ed75
(browse-url-browser-function): Fix syntax error.
Karl Heuer <kwzh@gnu.org>
parents:
17443
diff
changeset
|
238 `browse-url-of-file' commands. |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
239 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
240 If the value is not a function it should be a list of pairs |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
241 (REGEXP . FUNCTION). In this case the function called will be the one |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
242 associated with the first REGEXP which matches the current URL. The |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
243 function is passed the URL and any other args of `browse-url'. The last |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
244 regexp should probably be \".\" to specify a default browser." |
20460
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
245 :type '(choice |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
246 (function-item :tag "Emacs W3" :value browse-url-w3) |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
247 (function-item :tag "W3 in another Emacs via `gnudoit'" |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
248 :value browse-url-w3-gnudoit) |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
249 (function-item :tag "Netscape" :value browse-url-netscape) |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
250 (function-item :tag "Mosaic" :value browse-url-mosaic) |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
251 (function-item :tag "Mosaic using CCI" :value browse-url-cci) |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
252 (function-item :tag "IXI Mosaic" :value browse-url-iximosaic) |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
253 (function-item :tag "Lynx in an xterm window" |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
254 :value browse-url-lynx-xterm) |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
255 (function-item :tag "Lynx in an Emacs window" |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
256 :value browse-url-lynx-emacs) |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
257 (function-item :tag "Grail" :value browse-url-grail) |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
258 (function-item :tag "MMM" :value browse-url-mmm) |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
259 (function-item :tag "Specified by `Browse Url Generic Program'" |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
260 :value browse-url-generic) |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
261 (function :tag "Your own function")) |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
262 :group 'browse-url) |
13208 | 263 |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
264 (defcustom browse-url-netscape-program "netscape" |
24179
c2b622202522
(browse-url-netscape-program): Doc addition.
Dave Love <fx@gnu.org>
parents:
24126
diff
changeset
|
265 ;; Info about netscape-remote from Karl Berry. |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
266 "The name by which to invoke Netscape. |
20509
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
267 |
24179
c2b622202522
(browse-url-netscape-program): Doc addition.
Dave Love <fx@gnu.org>
parents:
24126
diff
changeset
|
268 The free program `netscape-remote' from |
c2b622202522
(browse-url-netscape-program): Doc addition.
Dave Love <fx@gnu.org>
parents:
24126
diff
changeset
|
269 <URL:http://home.netscape.com/newsref/std/remote.c> is said to start |
c2b622202522
(browse-url-netscape-program): Doc addition.
Dave Love <fx@gnu.org>
parents:
24126
diff
changeset
|
270 up very much quicker than `netscape'. Reported to compile on a GNU |
c2b622202522
(browse-url-netscape-program): Doc addition.
Dave Love <fx@gnu.org>
parents:
24126
diff
changeset
|
271 system, given vroot.h from the same directory, with cc flags |
c2b622202522
(browse-url-netscape-program): Doc addition.
Dave Love <fx@gnu.org>
parents:
24126
diff
changeset
|
272 -DSTANDALONE -L/usr/X11R6/lib -lXmu -lX11." |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
273 :type 'string |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
274 :group 'browse-url) |
15656
e73cd7ff1d4a
(browse-url-netscape-program): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
14734
diff
changeset
|
275 |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
276 (defcustom browse-url-netscape-arguments nil |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
277 "A list of strings to pass to Netscape as arguments." |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
278 :type '(repeat (string :tag "Argument")) |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
279 :group 'browse-url) |
13208 | 280 |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
281 (defcustom browse-url-netscape-startup-arguments browse-url-netscape-arguments |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
282 "A list of strings to pass to Netscape when it starts up. |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
283 Defaults to the value of `browse-url-netscape-arguments' at the time |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
284 `browse-url' is loaded." |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
285 :type '(repeat (string :tag "Argument")) |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
286 :group 'browse-url) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
287 |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
288 ;;;###autoload |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
289 (defcustom browse-url-new-window-p nil |
20460
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
290 "*If non-nil, always open a new browser window with appropriate browsers. |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
291 Passing an interactive argument to \\[browse-url], or specific browser |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
292 commands reverses the effect of this variable. Requires Netscape version |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
293 1.1N or later or XMosaic version 2.5 or later if using those browsers." |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
294 :type 'boolean |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
295 :group 'browse-url) |
13208 | 296 |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
297 ;;;###autoload |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
298 (defcustom browse-url-netscape-display nil |
20167 | 299 "*The X display for running Netscape, if not same as Emacs'." |
20460
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
300 :type '(choice string (const :tag "Default" nil)) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
301 :group 'browse-url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
302 |
20167 | 303 (defcustom browse-url-mosaic-program "xmosaic" |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
304 "The name by which to invoke Mosaic (or mMosaic)." |
20167 | 305 :type 'string |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
306 :version "20.3" |
20167 | 307 :group 'browse-url) |
308 | |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
309 (defcustom browse-url-mosaic-arguments nil |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
310 "A list of strings to pass to Mosaic as arguments." |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
311 :type '(repeat (string :tag "Argument")) |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
312 :group 'browse-url) |
13208 | 313 |
20509
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
314 (defcustom browse-url-filename-alist |
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
315 '(("^/\\(ftp@\\|anonymous@\\)?\\([^:]+\\):/*" . "ftp://\\2/") |
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
316 ;; The above loses the username to avoid the browser prompting for |
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
317 ;; it in anonymous cases. If it's not anonymous the next regexp |
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
318 ;; applies. |
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
319 ("^/\\([^:@]+@\\)?\\([^:]+\\):/*" . "ftp://\\1\\2/") |
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
320 ("^/+" . "file:/")) |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
321 "An alist of (REGEXP . STRING) pairs used by `browse-url-of-file'. |
20509
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
322 Any substring of a filename matching one of the REGEXPs is replaced by |
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
323 the corresponding STRING using `replace-match', not treating STRING |
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
324 literally. All pairs are applied in the order given. The default |
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
325 value converts ange-ftp/EFS-style paths into ftp URLs and prepends |
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
326 `file:' to any path beginning with `/'. |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
327 |
20509
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
328 For example, adding to the default a specific translation of an ange-ftp |
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
329 address to an HTTP URL: |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
330 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
331 (setq browse-url-filename-alist |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
332 '((\"/webmaster@webserver:/home/www/html/\" . |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
333 \"http://www.acme.co.uk/\") |
20509
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
334 (\"^/\\(ftp@\\|anonymous@\\)?\\([^:]+\\):/*\" . \"ftp://\\2/\") |
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
335 (\"^/\\([^:@]+@\\)?\\([^:]+\\):/*\" . \"ftp://\\1\\2/\") |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
336 (\"^/+\" . \"file:/\"))) |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
337 " |
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
338 :type '(repeat (cons :format "%v" |
20460
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
339 (regexp :tag "Regexp") |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
340 (string :tag "Replacement"))) |
20509
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
341 :version "20.3" |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
342 :group 'browse-url) |
13208 | 343 |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
344 ;;;###autoload |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
345 (defcustom browse-url-save-file nil |
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
346 "*If non-nil, save the buffer before displaying its file. |
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
347 Used by the `browse-url-of-file' command." |
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
348 :type 'boolean |
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
349 :group 'browse-url) |
13208 | 350 |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
351 (defcustom browse-url-of-file-hook nil |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
352 "Run after `browse-url-of-file' has asked a browser to load a file. |
13208 | 353 |
354 Set this to `browse-url-netscape-reload' to force Netscape to load the | |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
355 file rather than displaying a cached copy." |
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
356 :type 'hook |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
357 :options '(browse-url-netscape-reload) |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
358 :group 'browse-url) |
13208 | 359 |
360 (defvar browse-url-usr1-signal | |
361 (if (and (boundp 'emacs-major-version) | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
362 (or (> emacs-major-version 19) (>= emacs-minor-version 29))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
363 'SIGUSR1 ; Why did I think this was in lower case before? |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
364 30) ; Check /usr/include/signal.h. |
13208 | 365 "The argument to `signal-process' for sending SIGUSR1 to XMosaic. |
13938
3e0b6a3707bd
(browse-url-usr1-signal): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
13933
diff
changeset
|
366 Emacs 19.29 accepts 'SIGUSR1, earlier versions require an integer |
13208 | 367 which is 30 on SunOS and 16 on HP-UX and Solaris.") |
368 | |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
369 (defcustom browse-url-CCI-port 3003 |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
370 "Port to access XMosaic via CCI. |
13208 | 371 This can be any number between 1024 and 65535 but must correspond to |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
372 the value set in the browser." |
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
373 :type 'integer |
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
374 :group 'browse-url) |
13208 | 375 |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
376 (defcustom browse-url-CCI-host "localhost" |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
377 "*Host to access XMosaic via CCI. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
378 This should be the host name of the machine running XMosaic with CCI |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
379 enabled. The port number should be set in `browse-url-CCI-port'." |
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
380 :type 'string |
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
381 :group 'browse-url) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
382 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
383 (defvar browse-url-temp-file-name nil) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
384 (make-variable-buffer-local 'browse-url-temp-file-name) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
385 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
386 (defcustom browse-url-xterm-program "xterm" |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
387 "The name of the terminal emulator used by `browse-url-lynx-xterm'. |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
388 This might, for instance, be a separate colour version of xterm." |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
389 :type 'string |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
390 :group 'browse-url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
391 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
392 (defcustom browse-url-xterm-args nil |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
393 "*A list of strings defining options for `browse-url-xterm-program'. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
394 These might set its size, for instance." |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
395 :type '(repeat (string :tag "Argument")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
396 :group 'browse-url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
397 |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
398 (defcustom browse-url-lynx-emacs-args (and (not window-system) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
399 '("-show_cursor")) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
400 "A list of strings defining options for Lynx in an Emacs buffer. |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
401 |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
402 The default is none in a window system, otherwise `-show_cursor' to |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
403 indicate the position of the current link in the absence of |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
404 highlighting, assuming the normal default for showing the cursor." |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
405 :type '(repeat (string :tag "Argument")) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
406 :version "20.3" |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
407 :group 'browse-url) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
408 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
409 (defcustom browse-url-gnudoit-program "gnudoit" |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
410 "The name of the `gnudoit' program used by `browse-url-w3-gnudoit'." |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
411 :type 'string |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
412 :group 'browse-url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
413 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
414 (defcustom browse-url-gnudoit-args '("-q") |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
415 "*A list of strings defining options for `browse-url-gnudoit-program'. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
416 These might set the port, for instance." |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
417 :type '(repeat (string :tag "Argument")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
418 :group 'browse-url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
419 |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
420 ;;;###autoload |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
421 (defcustom browse-url-generic-program nil |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
422 "*The name of the browser program used by `browse-url-generic'." |
20460
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
423 :type '(choice string (const :tag "None" nil)) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
424 :group 'browse-url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
425 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
426 (defcustom browse-url-generic-args nil |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
427 "*A list of strings defining options for `browse-url-generic-program'." |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
428 :type '(repeat (string :tag "Argument")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
429 :group 'browse-url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
430 |
22097
67273fd206b7
(browse-url-temp-dir): Use temporary-file-directory.
Richard M. Stallman <rms@gnu.org>
parents:
22087
diff
changeset
|
431 (defcustom browse-url-temp-dir temporary-file-directory |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
432 "The name of a directory for browse-url's temporary files. |
20167 | 433 Such files are generated by functions like `browse-url-of-region'. |
434 You might want to set this to somewhere with restricted read permissions | |
435 for privacy's sake." | |
19442 | 436 :type 'string |
437 :group 'browse-url) | |
438 | |
19579
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
439 (defcustom browse-url-netscape-version |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
440 3 |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
441 "The version of Netscape you are using. |
19579
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
442 This affects how URL reloading is done; the mechanism changed |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
443 incompatibly at version 4." |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
444 :type 'number |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
445 :group 'browse-url) |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
446 |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
447 (defcustom browse-url-lynx-input-field 'avoid |
20167 | 448 "*Action on selecting an existing Lynx buffer at an input field. |
449 What to do when sending a new URL to an existing Lynx buffer in Emacs | |
450 if the Lynx cursor is on an input field (in which case the `g' command | |
451 would be entered as data). Such fields are recognized by the | |
452 underlines ____. Allowed values: nil: disregard it, 'warn: warn the | |
453 user and don't emit the URL, 'avoid: try to avoid the field by moving | |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
454 down (this *won't* always work)." |
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
455 :type '(choice (const :tag "Move to try to avoid field" :value avoid) |
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
456 (const :tag "Disregard" :value nil) |
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
457 (const :tag "Warn, don't emit URL" :value warn)) |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
458 :version "20.3" |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
459 :group 'browse-url) |
20167 | 460 |
22425
b235f1b173f3
Don't require dired when compiling.
Dave Love <fx@gnu.org>
parents:
22097
diff
changeset
|
461 (defvar browse-url-lynx-input-attempts 10 |
b235f1b173f3
Don't require dired when compiling.
Dave Love <fx@gnu.org>
parents:
22097
diff
changeset
|
462 "*How many times to try to move down from a series of lynx input fields.") |
20167 | 463 |
20320
dfd02d692b0c
Doc fixes and extra customization.
Dave Love <fx@gnu.org>
parents:
20167
diff
changeset
|
464 (defcustom browse-url-lynx-input-delay 0.2 |
22425
b235f1b173f3
Don't require dired when compiling.
Dave Love <fx@gnu.org>
parents:
22097
diff
changeset
|
465 "How many seconds to wait for lynx between moves down from an input field.") |
20167 | 466 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
467 (defvar browse-url-temp-file-list '()) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
468 |
13208 | 469 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
470 ;; URL input | |
471 | |
472 (defun browse-url-url-at-point () | |
18611
a3267de991c3
Require thingatpt when compiling.
Richard M. Stallman <rms@gnu.org>
parents:
18253
diff
changeset
|
473 (let ((url (thing-at-point 'url))) |
a3267de991c3
Require thingatpt when compiling.
Richard M. Stallman <rms@gnu.org>
parents:
18253
diff
changeset
|
474 (set-text-properties 0 (length url) nil url) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
475 url)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
476 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
477 ;; Having this as a separate function called by the browser-specific |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
478 ;; functions allows them to be stand-alone commands, making it easier |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
479 ;; to switch between browsers. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
480 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
481 (defun browse-url-interactive-arg (prompt) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
482 "Read a URL from the minibuffer, prompting with PROMPT. |
19442 | 483 Default to the URL at or before point. If invoked with a mouse button, |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
484 set point to the position clicked first. Return a list for use in |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
485 `interactive' containing the URL and `browse-url-new-window-p' or its |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
486 negation if a prefix argument was given." |
13208 | 487 (let ((event (elt (this-command-keys) 0))) |
488 (and (listp event) (mouse-set-point event))) | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
489 (list (read-string prompt (browse-url-url-at-point)) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
490 (not (eq (null browse-url-new-window-p) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
491 (null current-prefix-arg))))) |
13208 | 492 |
493 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
494 ;; Browse current buffer | |
495 | |
16416
c7622616333c
(browse-url-at-point): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
16415
diff
changeset
|
496 ;;;###autoload |
13208 | 497 (defun browse-url-of-file (&optional file) |
498 "Ask a WWW browser to display FILE. | |
499 Display the current buffer's file if FILE is nil or if called | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
500 interactively. Turn the filename into a URL with function |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
501 `browse-url-file-url'. Pass the URL to a browser using the |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
502 `browse-url' function then run `browse-url-of-file-hook'." |
13208 | 503 (interactive) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
504 (or file |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
505 (setq file (buffer-file-name)) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
506 (error "Current buffer has no file")) |
13208 | 507 (let ((buf (get-file-buffer file))) |
508 (if buf | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
509 (save-excursion |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
510 (set-buffer buf) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
511 (cond ((not (buffer-modified-p))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
512 (browse-url-save-file (save-buffer)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
513 (t (message "%s modified since last save" file)))))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
514 (browse-url (browse-url-file-url file)) |
13208 | 515 (run-hooks 'browse-url-of-file-hook)) |
516 | |
517 (defun browse-url-file-url (file) | |
518 "Return the URL corresponding to FILE. | |
20509
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
519 Use variable `browse-url-filename-alist' to map filenames to URLs." |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
520 ;; URL-encode special chars, do % first |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
521 (let ((s 0)) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
522 (while (setq s (string-match "%" file s)) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
523 (setq file (replace-match "%25" t t file) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
524 s (1+ s)))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
525 (while (string-match "[*\"()',=;? ]" file) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
526 (let ((enc (format "%%%x" (aref file (match-beginning 0))))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
527 (setq file (replace-match enc t t file)))) |
13208 | 528 (let ((maps browse-url-filename-alist)) |
529 (while maps | |
530 (let* ((map (car maps)) | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
531 (from-re (car map)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
532 (to-string (cdr map))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
533 (setq maps (cdr maps)) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
534 (and (string-match from-re file) |
20509
b0d79b1edeb6
(browse-url-path-regexp, browse-url-short-regexp,
Dave Love <fx@gnu.org>
parents:
20460
diff
changeset
|
535 (setq file (replace-match to-string t nil file)))))) |
13208 | 536 file) |
537 | |
16416
c7622616333c
(browse-url-at-point): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
16415
diff
changeset
|
538 ;;;###autoload |
13208 | 539 (defun browse-url-of-buffer (&optional buffer) |
540 "Ask a WWW browser to display BUFFER. | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
541 Display the current buffer if BUFFER is nil. Display only the |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
542 currently visible part of BUFFER (from a temporary file) if buffer is |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
543 narrowed." |
13208 | 544 (interactive) |
545 (save-excursion | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
546 (and buffer (set-buffer buffer)) |
13208 | 547 (let ((file-name |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
548 ;; Ignore real name if restricted |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
549 (and (= (- (point-max) (point-min)) (buffer-size)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
550 (or buffer-file-name |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
551 (and (boundp 'dired-directory) dired-directory))))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
552 (or file-name |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
553 (progn |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
554 (or browse-url-temp-file-name |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
555 (setq browse-url-temp-file-name |
19442 | 556 (convert-standard-filename |
557 (make-temp-name | |
558 (expand-file-name "burl" browse-url-temp-dir))))) | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
559 (setq file-name browse-url-temp-file-name) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
560 (write-region (point-min) (point-max) file-name nil 'no-message))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
561 (browse-url-of-file file-name)))) |
13208 | 562 |
563 (defun browse-url-delete-temp-file (&optional temp-file-name) | |
564 ;; Delete browse-url-temp-file-name from the file system and from | |
565 ;; browse-url-temp-file-list. If optional arg TEMP-FILE-NAME is | |
566 ;; non-nil, delete it instead, but only from the file system -- | |
567 ;; browse-url-temp-file-list is not affected. | |
568 (let ((file-name (or temp-file-name browse-url-temp-file-name))) | |
569 (if (and file-name (file-exists-p file-name)) | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
570 (progn |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
571 (delete-file file-name) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
572 (if (null temp-file-name) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
573 (setq browse-url-temp-file-list |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
574 (delete browse-url-temp-file-name |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
575 browse-url-temp-file-list))))))) |
13208 | 576 |
577 (defun browse-url-delete-temp-file-list () | |
578 ;; Delete all elements of browse-url-temp-file-list. | |
579 (while browse-url-temp-file-list | |
580 (browse-url-delete-temp-file (car browse-url-temp-file-list)) | |
581 (setq browse-url-temp-file-list | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
582 (cdr browse-url-temp-file-list)))) |
13208 | 583 |
584 (add-hook 'kill-buffer-hook 'browse-url-delete-temp-file) | |
585 (add-hook 'kill-emacs-hook 'browse-url-delete-temp-file-list) | |
586 | |
16416
c7622616333c
(browse-url-at-point): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
16415
diff
changeset
|
587 ;;;###autoload |
13208 | 588 (defun browse-url-of-dired-file () |
589 "In Dired, ask a WWW browser to display the file named on this line." | |
590 (interactive) | |
591 (browse-url-of-file (dired-get-filename))) | |
592 | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
593 ;;;###autoload |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
594 (defun browse-url-of-region (min max) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
595 "Ask a WWW browser to display the current region." |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
596 (interactive "r") |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
597 (save-excursion |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
598 (save-restriction |
21231
4d63d262b3d5
(browse-url-of-region): Use its args. From <mit@nines.nec.co.jp>
Dave Love <fx@gnu.org>
parents:
21078
diff
changeset
|
599 (narrow-to-region min max) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
600 (browse-url-of-buffer)))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
601 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
602 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
603 ;; Browser-independent commands |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
604 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
605 ;; A generic command to call the current browse-url-browser-function |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
606 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
607 ;;;###autoload |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
608 (defun browse-url (url &rest args) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
609 "Ask a WWW browser to load URL. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
610 Prompts for a URL, defaulting to the URL at or before point. Variable |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
611 `browse-url-browser-function' says which browser to use." |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
612 (interactive (browse-url-interactive-arg "URL: ")) |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
613 (let ((bf browse-url-browser-function) re) |
23705
e441cd61a9aa
1998-11-09 Sam Steingold <sds@goems.com>
Dave Love <fx@gnu.org>
parents:
23097
diff
changeset
|
614 (unless (functionp bf) |
e441cd61a9aa
1998-11-09 Sam Steingold <sds@goems.com>
Dave Love <fx@gnu.org>
parents:
23097
diff
changeset
|
615 (while (consp bf) |
e441cd61a9aa
1998-11-09 Sam Steingold <sds@goems.com>
Dave Love <fx@gnu.org>
parents:
23097
diff
changeset
|
616 (setq re (car (car bf)) |
e441cd61a9aa
1998-11-09 Sam Steingold <sds@goems.com>
Dave Love <fx@gnu.org>
parents:
23097
diff
changeset
|
617 bf (if (string-match re url) |
e441cd61a9aa
1998-11-09 Sam Steingold <sds@goems.com>
Dave Love <fx@gnu.org>
parents:
23097
diff
changeset
|
618 (cdr (car bf)) ; The function |
e441cd61a9aa
1998-11-09 Sam Steingold <sds@goems.com>
Dave Love <fx@gnu.org>
parents:
23097
diff
changeset
|
619 (cdr bf))))) ; More pairs |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
620 (or bf (error "No browser in browse-url-browser-function matching URL %s" |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
621 url)) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
622 (apply bf url args))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
623 |
16416
c7622616333c
(browse-url-at-point): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
16415
diff
changeset
|
624 ;;;###autoload |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
625 (defun browse-url-at-point () |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
626 "Ask a WWW browser to load the URL at or before point. |
20167 | 627 Doesn't let you edit the URL like `browse-url'. Variable |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
628 `browse-url-browser-function' says which browser to use." |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
629 (interactive) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
630 (browse-url (browse-url-url-at-point))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
631 |
17802
77d8356a7eed
(browse-url-event-buffer):
Richard M. Stallman <rms@gnu.org>
parents:
17456
diff
changeset
|
632 (defun browse-url-event-buffer (event) |
77d8356a7eed
(browse-url-event-buffer):
Richard M. Stallman <rms@gnu.org>
parents:
17456
diff
changeset
|
633 (window-buffer (posn-window (event-start event)))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
634 |
17802
77d8356a7eed
(browse-url-event-buffer):
Richard M. Stallman <rms@gnu.org>
parents:
17456
diff
changeset
|
635 (defun browse-url-event-point (event) |
77d8356a7eed
(browse-url-event-buffer):
Richard M. Stallman <rms@gnu.org>
parents:
17456
diff
changeset
|
636 (posn-point (event-start event))) |
13208 | 637 |
16416
c7622616333c
(browse-url-at-point): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
16415
diff
changeset
|
638 ;;;###autoload |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
639 (defun browse-url-at-mouse (event) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
640 "Ask a WWW browser to load a URL clicked with the mouse. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
641 The URL is the one around or before the position of the mouse click |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
642 but point is not changed. Doesn't let you edit the URL like |
20167 | 643 `browse-url'. Variable `browse-url-browser-function' says which browser |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
644 to use." |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
645 (interactive "e") |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
646 (save-excursion |
17802
77d8356a7eed
(browse-url-event-buffer):
Richard M. Stallman <rms@gnu.org>
parents:
17456
diff
changeset
|
647 (set-buffer (browse-url-event-buffer event)) |
77d8356a7eed
(browse-url-event-buffer):
Richard M. Stallman <rms@gnu.org>
parents:
17456
diff
changeset
|
648 (goto-char (browse-url-event-point event)) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
649 (let ((url (browse-url-url-at-point))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
650 (if (string-equal url "") |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
651 (error "No URL found")) |
20167 | 652 (browse-url url browse-url-new-window-p)))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
653 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
654 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
655 ;; Browser-specific commands |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
656 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
657 ;; --- Netscape --- |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
658 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
659 (defun browse-url-process-environment () |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
660 "Set DISPLAY in the environment to the X display Netscape is running on. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
661 This is either the value of variable `browse-url-netscape-display' if |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
662 non-nil, or the same display as Emacs if different from the current |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
663 environment, otherwise just use the current environment." |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
664 (let ((display (or browse-url-netscape-display (browse-url-emacs-display)))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
665 (if display |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
666 (cons (concat "DISPLAY=" display) process-environment) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
667 process-environment))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
668 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
669 (defun browse-url-emacs-display () |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
670 "Return the X display Emacs is running on. |
20167 | 671 This is nil if the display is the same as the DISPLAY environment variable. |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
672 |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
673 Actually Emacs could be using several displays; this just returns the |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
674 one showing the selected frame." |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
675 (let ((display (cdr-safe (assq 'display (frame-parameters))))) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
676 (and (not (equal display (getenv "DISPLAY"))) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
677 display))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
678 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
679 ;;;###autoload |
13208 | 680 (defun browse-url-netscape (url &optional new-window) |
681 "Ask the Netscape WWW browser to load URL. | |
682 | |
683 Default to the URL around or before point. The strings in variable | |
684 `browse-url-netscape-arguments' are also passed to Netscape. | |
685 | |
686 When called interactively, if variable `browse-url-new-window-p' is | |
687 non-nil, load the document in a new Netscape window, otherwise use a | |
688 random existing one. A non-nil interactive prefix argument reverses | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
689 the effect of `browse-url-new-window-p'. |
13208 | 690 |
691 When called non-interactively, optional second argument NEW-WINDOW is | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
692 used instead of `browse-url-new-window-p'." |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
693 (interactive (browse-url-interactive-arg "Netscape URL: ")) |
22507
f189183483a2
(browse-url-netscape): Encode `)' too.
Dave Love <fx@gnu.org>
parents:
22425
diff
changeset
|
694 ;; URL encode any `confusing' characters in the URL. This needs to |
f189183483a2
(browse-url-netscape): Encode `)' too.
Dave Love <fx@gnu.org>
parents:
22425
diff
changeset
|
695 ;; include at least commas; presumably also close parens. |
f189183483a2
(browse-url-netscape): Encode `)' too.
Dave Love <fx@gnu.org>
parents:
22425
diff
changeset
|
696 (while (string-match "[,)]" url) |
f189183483a2
(browse-url-netscape): Encode `)' too.
Dave Love <fx@gnu.org>
parents:
22425
diff
changeset
|
697 (setq url (replace-match |
23097
86a92272892c
(browse-url-netscape): Fix format for hex escapes.
Dave Love <fx@gnu.org>
parents:
22507
diff
changeset
|
698 (format "%%%x" (string-to-char (match-string 0 url))) t t url))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
699 (let* ((process-environment (browse-url-process-environment)) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
700 (process (apply 'start-process |
24063
2dde27ae5540
(browse-url-netscape): Fix ineffective "-noraise".
Dave Love <fx@gnu.org>
parents:
24010
diff
changeset
|
701 (concat "netscape " url) nil |
2dde27ae5540
(browse-url-netscape): Fix ineffective "-noraise".
Dave Love <fx@gnu.org>
parents:
24010
diff
changeset
|
702 browse-url-netscape-program |
2dde27ae5540
(browse-url-netscape): Fix ineffective "-noraise".
Dave Love <fx@gnu.org>
parents:
24010
diff
changeset
|
703 (append |
2dde27ae5540
(browse-url-netscape): Fix ineffective "-noraise".
Dave Love <fx@gnu.org>
parents:
24010
diff
changeset
|
704 browse-url-netscape-arguments |
2dde27ae5540
(browse-url-netscape): Fix ineffective "-noraise".
Dave Love <fx@gnu.org>
parents:
24010
diff
changeset
|
705 (if (eq window-system 'w32) |
2dde27ae5540
(browse-url-netscape): Fix ineffective "-noraise".
Dave Love <fx@gnu.org>
parents:
24010
diff
changeset
|
706 (list url) |
2dde27ae5540
(browse-url-netscape): Fix ineffective "-noraise".
Dave Love <fx@gnu.org>
parents:
24010
diff
changeset
|
707 (append |
2dde27ae5540
(browse-url-netscape): Fix ineffective "-noraise".
Dave Love <fx@gnu.org>
parents:
24010
diff
changeset
|
708 (if new-window '("-noraise")) |
2dde27ae5540
(browse-url-netscape): Fix ineffective "-noraise".
Dave Love <fx@gnu.org>
parents:
24010
diff
changeset
|
709 (list "-remote" |
2dde27ae5540
(browse-url-netscape): Fix ineffective "-noraise".
Dave Love <fx@gnu.org>
parents:
24010
diff
changeset
|
710 (concat "openURL(" url |
24126
8ebecccf46a6
(browse-url-maybe-new-window): Delete macro and
Dave Love <fx@gnu.org>
parents:
24063
diff
changeset
|
711 (if new-window ",new-window") |
24063
2dde27ae5540
(browse-url-netscape): Fix ineffective "-noraise".
Dave Love <fx@gnu.org>
parents:
24010
diff
changeset
|
712 ")")))))))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
713 (set-process-sentinel process |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
714 (list 'lambda '(process change) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
715 (list 'browse-url-netscape-sentinel 'process url))))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
716 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
717 (defun browse-url-netscape-sentinel (process url) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
718 "Handle a change to the process communicating with Netscape." |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
719 (or (eq (process-exit-status process) 0) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
720 (let* ((process-environment (browse-url-process-environment))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
721 ;; Netscape not running - start it |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
722 (message "Starting Netscape...") |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
723 (apply 'start-process (concat "netscape" url) nil |
17975
3f2cc6cc8705
(browse-url-netscape, browse-url-netscape-sentinel)
Richard M. Stallman <rms@gnu.org>
parents:
17862
diff
changeset
|
724 browse-url-netscape-program |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
725 (append browse-url-netscape-startup-arguments (list url)))))) |
13208 | 726 |
727 (defun browse-url-netscape-reload () | |
20167 | 728 "Ask Netscape to reload its current document. |
729 How depends on `browse-url-netscape-version'." | |
13208 | 730 (interactive) |
19579
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
731 ;; Backwards incompatibility reported by |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
732 ;; <peter.kruse@psychologie.uni-regensburg.de>. |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
733 (browse-url-netscape-send (if (>= browse-url-netscape-version 4) |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
734 "xfeDoCommand(reload)" |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
735 "reload"))) |
13208 | 736 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
737 (defun browse-url-netscape-send (command) |
13208 | 738 "Send a remote control command to Netscape." |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
739 (let* ((process-environment (browse-url-process-environment))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
740 (apply 'start-process "netscape" nil |
17975
3f2cc6cc8705
(browse-url-netscape, browse-url-netscape-sentinel)
Richard M. Stallman <rms@gnu.org>
parents:
17862
diff
changeset
|
741 browse-url-netscape-program |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
742 (append browse-url-netscape-arguments |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
743 (list "-remote" command))))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
744 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
745 ;; --- Mosaic --- |
13208 | 746 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
747 ;;;###autoload |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
748 (defun browse-url-mosaic (url &optional new-window) |
13208 | 749 "Ask the XMosaic WWW browser to load URL. |
20167 | 750 |
751 Default to the URL around or before point. The strings in variable | |
752 `browse-url-mosaic-arguments' are also passed to Mosaic and the | |
753 program is invoked according to the variable | |
754 `browse-url-mosaic-program'. | |
755 | |
756 When called interactively, if variable `browse-url-new-window-p' is | |
757 non-nil, load the document in a new Mosaic window, otherwise use a | |
758 random existing one. A non-nil interactive prefix argument reverses | |
759 the effect of `browse-url-new-window-p'. | |
760 | |
761 When called non-interactively, optional second argument NEW-WINDOW is | |
762 used instead of `browse-url-new-window-p'." | |
13208 | 763 (interactive (browse-url-interactive-arg "Mosaic URL: ")) |
764 (let ((pidfile (expand-file-name "~/.mosaicpid")) | |
22425
b235f1b173f3
Don't require dired when compiling.
Dave Love <fx@gnu.org>
parents:
22097
diff
changeset
|
765 pid) |
13208 | 766 (if (file-readable-p pidfile) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
767 (save-excursion |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
768 (find-file pidfile) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
769 (goto-char (point-min)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
770 (setq pid (read (current-buffer))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
771 (kill-buffer nil))) |
13208 | 772 (if (and pid (zerop (signal-process pid 0))) ; Mosaic running |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
773 (save-excursion |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
774 (find-file (format "/tmp/Mosaic.%d" pid)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
775 (erase-buffer) |
24126
8ebecccf46a6
(browse-url-maybe-new-window): Delete macro and
Dave Love <fx@gnu.org>
parents:
24063
diff
changeset
|
776 (insert (if new-window |
20167 | 777 "newwin\n" |
24126
8ebecccf46a6
(browse-url-maybe-new-window): Delete macro and
Dave Love <fx@gnu.org>
parents:
24063
diff
changeset
|
778 "goto\n") |
20167 | 779 url "\n") |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
780 (save-buffer) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
781 (kill-buffer nil) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
782 ;; Send signal SIGUSR to Mosaic |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
783 (message "Signalling Mosaic...") |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
784 (signal-process pid browse-url-usr1-signal) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
785 ;; Or you could try: |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
786 ;; (call-process "kill" nil 0 nil "-USR1" (int-to-string pid)) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
787 (message "Signalling Mosaic...done") |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
788 ) |
13208 | 789 ;; Mosaic not running - start it |
790 (message "Starting Mosaic...") | |
20167 | 791 (apply 'start-process "xmosaic" nil browse-url-mosaic-program |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
792 (append browse-url-mosaic-arguments (list url))) |
13933
efd6ce432dc5
(browse-url-mosaic): Print "done" message
Richard M. Stallman <rms@gnu.org>
parents:
13224
diff
changeset
|
793 (message "Starting Mosaic...done")))) |
13208 | 794 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
795 ;; --- Grail --- |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
796 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
797 ;;;###autoload |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
798 (defvar browse-url-grail |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
799 (concat (or (getenv "GRAILDIR") "~/.grail") "/user/rcgrail.py") |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
800 "Location of Grail remote control client script `rcgrail.py'. |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
801 Typically found in $GRAILDIR/rcgrail.py, or ~/.grail/user/rcgrail.py.") |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
802 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
803 ;;;###autoload |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
804 (defun browse-url-grail (url &optional new-window) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
805 "Ask the Grail WWW browser to load URL. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
806 Default to the URL around or before point. Runs the program in the |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
807 variable `browse-url-grail'." |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
808 (interactive (browse-url-interactive-arg "Grail URL: ")) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
809 (message "Sending URL to Grail...") |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
810 (save-excursion |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
811 (set-buffer (get-buffer-create " *Shell Command Output*")) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
812 (erase-buffer) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
813 ;; don't worry about this failing. |
22425
b235f1b173f3
Don't require dired when compiling.
Dave Love <fx@gnu.org>
parents:
22097
diff
changeset
|
814 (if new-window |
b235f1b173f3
Don't require dired when compiling.
Dave Love <fx@gnu.org>
parents:
22097
diff
changeset
|
815 (call-process browse-url-grail nil 0 nil "-b" url) |
b235f1b173f3
Don't require dired when compiling.
Dave Love <fx@gnu.org>
parents:
22097
diff
changeset
|
816 (call-process browse-url-grail nil 0 nil url)) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
817 (message "Sending URL to Grail... done"))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
818 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
819 ;; --- Mosaic using CCI --- |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
820 |
22425
b235f1b173f3
Don't require dired when compiling.
Dave Love <fx@gnu.org>
parents:
22097
diff
changeset
|
821 ;;;###autoload |
13208 | 822 (defun browse-url-cci (url &optional new-window) |
823 "Ask the XMosaic WWW browser to load URL. | |
824 Default to the URL around or before point. | |
825 | |
826 This function only works for XMosaic version 2.5 or later. You must | |
827 select `CCI' from XMosaic's File menu, set the CCI Port Address to the | |
828 value of variable `browse-url-CCI-port', and enable `Accept requests'. | |
829 | |
830 When called interactively, if variable `browse-url-new-window-p' is | |
831 non-nil, load the document in a new browser window, otherwise use a | |
832 random existing one. A non-nil interactive prefix argument reverses | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
833 the effect of `browse-url-new-window-p'. |
13208 | 834 |
835 When called non-interactively, optional second argument NEW-WINDOW is | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
836 used instead of `browse-url-new-window-p'." |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
837 (interactive (browse-url-interactive-arg "Mosaic URL: ")) |
13208 | 838 (open-network-stream "browse-url" " *browse-url*" |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
839 browse-url-CCI-host browse-url-CCI-port) |
13208 | 840 ;; Todo: start browser if fails |
841 (process-send-string "browse-url" | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
842 (concat "get url (" url ") output " |
24126
8ebecccf46a6
(browse-url-maybe-new-window): Delete macro and
Dave Love <fx@gnu.org>
parents:
24063
diff
changeset
|
843 (if new-window |
20167 | 844 "new" |
845 "current") | |
846 "\r\n")) | |
13208 | 847 (process-send-string "browse-url" "disconnect\r\n") |
848 (delete-process "browse-url")) | |
849 | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
850 ;; --- IXI Mosaic --- |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
851 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
852 ;;;###autoload |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
853 (defun browse-url-iximosaic (url &optional new-window) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
854 ;; new-window ignored |
13208 | 855 "Ask the IXIMosaic WWW browser to load URL. |
856 Default to the URL around or before point." | |
857 (interactive (browse-url-interactive-arg "IXI Mosaic URL: ")) | |
858 (start-process "tellw3b" nil "tellw3b" | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
859 "-service WWW_BROWSER ixi_showurl " url)) |
13208 | 860 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
861 ;; --- W3 --- |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
862 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
863 ;;;###autoload |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
864 (defun browse-url-w3 (url &optional new-window) |
13208 | 865 "Ask the w3 WWW browser to load URL. |
20460
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
866 Default to the URL around or before point. |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
867 |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
868 When called interactively, if variable `browse-url-new-window-p' is |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
869 non-nil, load the document in a new window. A non-nil interactive |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
870 prefix argument reverses the effect of `browse-url-new-window-p'. |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
871 |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
872 When called non-interactively, optional second argument NEW-WINDOW is |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
873 used instead of `browse-url-new-window-p'." |
13208 | 874 (interactive (browse-url-interactive-arg "W3 URL: ")) |
24010 | 875 (require 'w3) ; w3-fetch-other-window not autoloaded |
24126
8ebecccf46a6
(browse-url-maybe-new-window): Delete macro and
Dave Love <fx@gnu.org>
parents:
24063
diff
changeset
|
876 (if new-window |
24010 | 877 (w3-fetch-other-window url) |
20167 | 878 (w3-fetch url))) |
13208 | 879 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
880 ;;;###autoload |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
881 (defun browse-url-w3-gnudoit (url &optional new-window) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
882 ;; new-window ignored |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
883 "Ask another Emacs running gnuserv to load the URL using the W3 browser. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
884 The `browse-url-gnudoit-program' program is used with options given by |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
885 `browse-url-gnudoit-args'. Default to the URL around or before point." |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
886 (interactive (browse-url-interactive-arg "W3 URL: ")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
887 (apply 'start-process (concat "gnudoit:" url) nil |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
888 browse-url-gnudoit-program |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
889 (append browse-url-gnudoit-args (list (concat "(w3-fetch \"" url "\")") "(raise-frame)")))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
890 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
891 ;; --- Lynx in an xterm --- |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
892 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
893 ;;;###autoload |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
894 (defun browse-url-lynx-xterm (url &optional new-window) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
895 ;; new-window ignored |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
896 "Ask the Lynx WWW browser to load URL. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
897 Default to the URL around or before point. A new Lynx process is run |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
898 in an Xterm window using the Xterm program named by `browse-url-xterm-program' |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
899 with possible additional arguments `browse-url-xterm-args'." |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
900 (interactive (browse-url-interactive-arg "Lynx URL: ")) |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
901 (apply #'start-process `(,(concat "lynx" url) nil ,browse-url-xterm-program |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
902 ,@browse-url-xterm-args "-e" "lynx" ,url))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
903 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
904 ;; --- Lynx in an Emacs "term" window --- |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
905 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
906 ;;;###autoload |
20167 | 907 (defun browse-url-lynx-emacs (url &optional new-buffer) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
908 "Ask the Lynx WWW browser to load URL. |
20167 | 909 Default to the URL around or before point. With a prefix argument, run |
20460
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
910 a new Lynx process in a new buffer. |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
911 |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
912 When called interactively, if variable `browse-url-new-window-p' is |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
913 non-nil, load the document in a new lynx in a new term window, |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
914 otherwise use any existing one. A non-nil interactive prefix argument |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
915 reverses the effect of `browse-url-new-window-p'. |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
916 |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
917 When called non-interactively, optional second argument NEW-WINDOW is |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
918 used instead of `browse-url-new-window-p'." |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
919 (interactive (browse-url-interactive-arg "Lynx URL: ")) |
20167 | 920 (let* ((system-uses-terminfo t) ; Lynx uses terminfo |
921 ;; (term-term-name "vt100") ; ?? | |
922 (buf (get-buffer "*lynx*")) | |
923 (proc (and buf (get-buffer-process buf))) | |
924 (n browse-url-lynx-input-attempts)) | |
24126
8ebecccf46a6
(browse-url-maybe-new-window): Delete macro and
Dave Love <fx@gnu.org>
parents:
24063
diff
changeset
|
925 (if (and new-buffer buf) |
20167 | 926 ;; Rename away the OLD buffer. This isn't very polite, but |
927 ;; term insists on working in a buffer named *lynx* and would | |
928 ;; choke on *lynx*<1> | |
929 (progn (set-buffer buf) | |
930 (rename-uniquely))) | |
24126
8ebecccf46a6
(browse-url-maybe-new-window): Delete macro and
Dave Love <fx@gnu.org>
parents:
24063
diff
changeset
|
931 (if (or new-buffer |
20167 | 932 (not buf) |
933 (not proc) | |
934 (not (memq (process-status proc) '(run stop)))) | |
935 ;; start a new lynx | |
21078
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
936 (progn |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
937 (setq buf |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
938 (apply #'make-term |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
939 `("lynx" "lynx" nil ,@browse-url-lynx-emacs-args ,url))) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
940 (switch-to-buffer buf) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
941 (term-char-mode) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
942 (set-process-sentinel |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
943 (get-buffer-process buf) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
944 ;; Don't leave around a dead one (especially because of its |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
945 ;; munged keymap.) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
946 (lambda (process event) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
947 (if (not (memq (process-status process) '(run stop))) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
948 (let ((buf (process-buffer process))) |
64a6c0b65eaa
Various doc fixes, mainly to remove innappropriate
Dave Love <fx@gnu.org>
parents:
20509
diff
changeset
|
949 (if buf (kill-buffer buf))))))) |
20167 | 950 ;; send the url to lynx in the old buffer |
951 (let ((win (get-buffer-window buf t))) | |
952 (if win | |
953 (select-window win) | |
954 (switch-to-buffer buf))) | |
955 (if (eq (following-char) ?_) | |
956 (cond ((eq browse-url-lynx-input-field 'warn) | |
957 (error "Please move out of the input field first.")) | |
958 ((eq browse-url-lynx-input-field 'avoid) | |
959 (while (and (eq (following-char) ?_) (> n 0)) | |
960 (term-send-down) ; down arrow | |
961 (sit-for browse-url-lynx-input-delay)) | |
962 (if (eq (following-char) ?_) | |
963 (error "Cannot move out of the input field, sorry."))))) | |
964 (term-send-string proc (concat "g" ; goto | |
965 "\C-u" ; kill default url | |
966 url | |
967 "\r"))))) | |
15780
0a03d2b02ba1
(browse-url-choose-browser): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15656
diff
changeset
|
968 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
969 ;; --- MMM --- |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
970 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
971 ;;;###autoload |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
972 (defun browse-url-mmm (url &optional new-window) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
973 "Ask the MMM WWW browser to load URL. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
974 Default to the URL around or before point." |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
975 (interactive (browse-url-interactive-arg "MMM URL: ")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
976 (message "Sending URL to MMM...") |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
977 (save-excursion |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
978 (set-buffer (get-buffer-create " *Shell Command Output*")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
979 (erase-buffer) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
980 ;; mmm_remote just SEGVs if the file isn't there... |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
981 (if (or (file-exists-p (expand-file-name "~/.mmm_remote")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
982 ;; location in v 0.4: |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
983 (file-exists-p (expand-file-name "~/.mmm/remote"))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
984 (call-process "mmm_remote" nil 0 nil url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
985 (call-process "mmm" nil 0 nil "-external" url)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
986 (message "Sending URL to MMM... done"))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
987 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
988 ;; --- mailto --- |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
989 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
990 ;;;###autoload |
19583
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
991 (defun browse-url-mail (url &optional new-window) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
992 "Open a new mail message buffer within Emacs. |
19583
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
993 Default to using the mailto: URL around or before point as the |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
994 recipient's address. Supplying a non-nil interactive prefix argument |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
995 will cause the mail to be composed in another window rather than the |
20460
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
996 current one. |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
997 |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
998 When called interactively, if variable `browse-url-new-window-p' is |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
999 non-nil use `compose-mail-other-window', otherwise `compose-mail'. A |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
1000 non-nil interactive prefix argument reverses the effect of |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
1001 `browse-url-new-window-p'. |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
1002 |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
1003 When called non-interactively, optional second argument NEW-WINDOW is |
9bef2b27cdaa
(browse-url-lynx-emacs): Add sentinel to kill the buffer when lynx
Dave Love <fx@gnu.org>
parents:
20320
diff
changeset
|
1004 used instead of `browse-url-new-window-p'." |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1005 (interactive (browse-url-interactive-arg "Mailto URL: ")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1006 (save-excursion |
23839
2dcf9631cad2
(browse-url-mail): Call compose-mail-other-window
Dave Love <fx@gnu.org>
parents:
23705
diff
changeset
|
1007 (let ((to (if (string-match "^mailto:" url) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1008 (substring url 7) |
19583
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
1009 url))) |
24126
8ebecccf46a6
(browse-url-maybe-new-window): Delete macro and
Dave Love <fx@gnu.org>
parents:
24063
diff
changeset
|
1010 (if new-window |
23959
af78e18ed775
(browse-url-mail): Give argument SEND-ACTION
Richard M. Stallman <rms@gnu.org>
parents:
23839
diff
changeset
|
1011 (compose-mail-other-window to nil nil nil |
af78e18ed775
(browse-url-mail): Give argument SEND-ACTION
Richard M. Stallman <rms@gnu.org>
parents:
23839
diff
changeset
|
1012 (list 'insert-buffer (current-buffer))) |
af78e18ed775
(browse-url-mail): Give argument SEND-ACTION
Richard M. Stallman <rms@gnu.org>
parents:
23839
diff
changeset
|
1013 (compose-mail to nil nil nil nil |
af78e18ed775
(browse-url-mail): Give argument SEND-ACTION
Richard M. Stallman <rms@gnu.org>
parents:
23839
diff
changeset
|
1014 (list 'insert-buffer (current-buffer))))))) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1015 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1016 ;; --- Random browser --- |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1017 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1018 ;;;###autoload |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1019 (defun browse-url-generic (url &optional new-window) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1020 ;; new-window ignored |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1021 "Ask the WWW browser defined by `browse-url-generic-program' to load URL. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1022 Default to the URL around or before point. A fresh copy of the |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1023 browser is started up in a new process with possible additional arguments |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1024 `browse-url-generic-args'. This is appropriate for browsers which |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1025 don't offer a form of remote control." |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1026 (interactive (browse-url-interactive-arg "URL: ")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1027 (if (not browse-url-generic-program) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1028 (error "No browser defined (`browse-url-generic-program')")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1029 (apply 'start-process (concat browse-url-generic-program url) nil |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1030 browse-url-generic-program |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1031 (append browse-url-generic-args (list url)))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
1032 |
13208 | 1033 (provide 'browse-url) |
1034 | |
1035 ;;; browse-url.el ends here |