Mercurial > emacs
annotate lisp/browse-url.el @ 19860:c17fd465ea95 libc-970911 libc-970912 libc-970913 libc-970914 libc-970915 libc-970916 libc-970917 libc-970918 libc-970919 libc-970920 libc-970921 libc-970922 libc-970923 libc-970924 libc-970925 libc-970926 libc-970927 libc-970928 libc-970929 libc-970930 libc-971001 libc-971018 libc-971019 libc-971020 libc-971021 libc-971022 libc-971023 libc-971024 libc-971025 libc-971026 libc-971027 libc-971028 libc-971029 libc-971030 libc-971031 libc-971101 libc-971102 libc-971103 libc-971104 libc-971105 libc-971106 libc-971107 libc-971108 libc-971109 libc-971110 libc-971111 libc-971112 libc-971113 libc-971114 libc-971115 libc-971116 libc-971117 libc-971118 libc-971120 libc-971121 libc-971122 libc-971123 libc-971124 libc-971125 libc-971126 libc-971127 libc-971128 libc-971129 libc-971130 libc-971201 libc-971203 libc-971204 libc-971205 libc-971206 libc-971207 libc-971208 libc-971209 libc-971210 libc-971211 libc-971212 libc-971213 libc-971214 libc-971217 libc-971218 libc-971219 libc-971220 libc-971221 libc-971222 libc-971223 libc-971224 libc-971225 libc-971226 libc-971227 libc-971228 libc-971229 libc-971230 libc-971231 libc-980103 libc-980104 libc-980105 libc-980106 libc-980107 libc-980108 libc-980109 libc-980110 libc-980111 libc-980112 libc-980114 libc-980115 libc-980116 libc-980117 libc-980118 libc-980119 libc-980120 libc-980121 libc-980122 libc-980123 libc-980124 libc-980125 libc-980126 libc-980127 libc-980128
typos.
author | Jeff Law <law@redhat.com> |
---|---|
date | Wed, 10 Sep 1997 21:16:20 +0000 |
parents | 1e9841e7163a |
children | 14f83589db18 |
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 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
3 ;; Copyright 1995, 1996, 1997 Free Software Foundation, Inc. |
13208 | 4 |
5 ;; Author: Denis Howe <dbh@doc.ic.ac.uk> | |
18224 | 6 ;; Maintainer: Dave Love <d.love@dl.ac.uk> |
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 ;; X-Home page: http://wombat.doc.ic.ac.uk/ |
10 | |
11 ;; This file is part of GNU Emacs. | |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14169 | 14 ;; it under the terms of the GNU General Public License as published by |
15 ;; the Free Software Foundation; either version 2, or (at your option) | |
16 ;; any later version. | |
13208 | 17 |
14169 | 18 ;; GNU Emacs is distributed in the hope that it will be useful, |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
13208 | 22 |
23 ;; You should have received a copy of the GNU General Public License | |
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
14169 | 25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
26 ;; Boston, MA 02111-1307, USA. | |
13208 | 27 |
28 ;;; Commentary: | |
29 | |
30 ;; The latest version of this package should be available from | |
31 ;; <URL:http://wombat.doc.ic.ac.uk/emacs/browse-url.el>. | |
32 | |
33 ;; This package provides functions which read a URL (Uniform Resource | |
34 ;; Locator) from the minibuffer, defaulting to the URL around point, | |
35 ;; and ask a World-Wide Web browser to load it. It can also load the | |
36 ;; URL associated with the current buffer. Different browsers use | |
37 ;; different methods of remote control so there is one function for | |
38 ;; each supported browser. If the chosen browser is not running, it | |
39 ;; is started. Currently there is support for: | |
40 | |
41 ;; Function Browser Earliest version | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
42 ;; browse-url-netscape Netscape 1.1b1 |
13208 | 43 ;; browse-url-mosaic XMosaic <= 2.4 |
44 ;; browse-url-cci XMosaic 2.5 | |
45 ;; browse-url-w3 w3 0 | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
46 ;; browse-url-w3-gnudoit w3 remotely |
13208 | 47 ;; browse-url-iximosaic IXI Mosaic ? |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
48 ;; browse-url-lynx-* Lynx 0 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
49 ;; 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
|
50 ;; browse-url-mmm MMM ? |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
51 ;; browse-url-generic arbitrary |
13208 | 52 |
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 |
56 ;; Netscape can cache Web pages so it may be necessary to tell it 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 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
78 ;; <URL:http://hplbwww.hpl.hp.com/people/ange/gnuserv/>. |
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 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
88 ;; MMM is the freely available WWW browser implemented in Caml Special |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
89 ;; Light, a cool impure functional programming language, by Francois |
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 | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
99 ;; <URL:ftp://ftp.yggdrasil.com/pub/dist/web/arena>, Amaya |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
100 ;; <URL:ftp://ftp.w3.org/pub/amaya>, mMosaic |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
101 ;; <URL:ftp://sig.enst.fr/pub/multicast/mMosaic/> (the latter with |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
102 ;; development support for Java applets). |
13208 | 103 |
19583
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
104 ;; I [Denis Howe] recommend Nelson Minar <nelson@santafe.edu>'s excellent |
13208 | 105 ;; html-helper-mode.el for editing HTML and thank Nelson for |
106 ;; 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
|
107 ;; <URL:http://www.santafe.edu/%7Enelson/hhm-beta/> |
13208 | 108 |
19583
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
109 ;; 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
|
110 ;; 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
|
111 ;; 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
|
112 ;; <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
|
113 ;; with this. |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
114 |
13208 | 115 ;; This package generalises function html-previewer-process in Marc |
116 ;; Andreessen <marca@ncsa.uiuc.edu>'s html-mode (LCD | |
117 ;; modes/html-mode.el.Z) and provides better versions of the URL | |
118 ;; functions in Michelangelo Grigni <mic@cs.ucsd.edu>'s ffap.el | |
119 ;; (find-file-at-point) <URL:ftp://cs.ucsd.edu:/pub/mic/>. The huge | |
120 ;; hyperbole package also contains similar functions. | |
121 | |
122 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
123 ;; Help! | |
124 | |
125 ;; Can you write and test some code for the Macintrash and Windoze | |
126 ;; Netscape remote control APIs? (See the URL above). | |
127 | |
128 ;; Do any other browsers have remote control? | |
129 | |
130 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
131 ;; Usage | |
132 | |
133 ;; To display the URL at or before point: | |
134 ;; 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
|
135 ;; 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
|
136 ;; the buffer, use: |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
137 ;; M-x browse-url |
13208 | 138 |
139 ;; To display a URL by shift-clicking on it, put this in your ~/.emacs | |
140 ;; file: | |
13933
efd6ce432dc5
(browse-url-mosaic): Print "done" message
Richard M. Stallman <rms@gnu.org>
parents:
13224
diff
changeset
|
141 ;; (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
|
142 ;; (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
|
143 ;; that event has a standard meaning in Emacs.) |
13208 | 144 |
145 ;; To display the current buffer in a web browser: | |
146 ;; M-x browse-url-of-buffer RET | |
147 | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
148 ;; 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
|
149 ;; 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
|
150 |
13208 | 151 ;; In Dired, to display the file named on the current line: |
152 ;; M-x browse-url-of-dired-file RET | |
153 | |
154 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
155 ;; Customisation (~/.emacs) | |
156 | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
157 ;; To see what variables are available for customization, type |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
158 ;; `M-x set-variable browse-url TAB'. |
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 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
168 ;; (function (lambda () |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
169 ;; (local-set-key "\C-c\C-zf" 'browse-url-of-dired-file)))) |
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: |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
172 ;; (add-hook 'rmail-mode-hook (function (lambda () ; rmail-mode startup |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
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 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
195 ;; (function (lambda () |
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 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
197 ;; (function (lambda () |
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) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
201 ;; t)) ; => file written by hook |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
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 | |
18611
a3267de991c3
Require thingatpt when compiling.
Richard M. Stallman <rms@gnu.org>
parents:
18253
diff
changeset
|
221 (eval-when-compile (require 'dired) |
a3267de991c3
Require thingatpt when compiling.
Richard M. Stallman <rms@gnu.org>
parents:
18253
diff
changeset
|
222 (require 'thingatpt)) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
223 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
224 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
225 ;; Variables |
13208 | 226 |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
227 (defgroup browse-url nil |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
228 "Use a web browser to look at a URL." |
19579
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
229 :group 'hypermedia) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
230 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
231 ;;;###autoload |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
232 (defcustom browse-url-browser-function |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
233 'browse-url-netscape |
13208 | 234 "*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
|
235 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
|
236 `browse-url-of-file' commands. |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
237 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
238 If the value is not a function it should be a list of pairs |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
239 (REGEXP.FUNCTION). In this case the function called will be the one |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
240 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
|
241 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
|
242 regexp should probably be \".\" to specify a default browser." |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
243 :type 'function |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
244 :group 'browse-url) |
13208 | 245 |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
246 (defcustom browse-url-netscape-program "netscape" |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
247 "*The name by which to invoke Netscape." |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
248 :type 'string |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
249 :group 'browse-url) |
15656
e73cd7ff1d4a
(browse-url-netscape-program): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
14734
diff
changeset
|
250 |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
251 (defcustom browse-url-netscape-arguments nil |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
252 "*A list of strings to pass to Netscape as arguments." |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
253 :type '(repeat (string :tag "Argument")) |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
254 :group 'browse-url) |
13208 | 255 |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
256 (defcustom browse-url-netscape-startup-arguments browse-url-netscape-arguments |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
257 "*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
|
258 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
|
259 `browse-url' is loaded." |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
260 :type '(repeat (string :tag "Argument")) |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
261 :group 'browse-url) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
262 |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
263 (defcustom browse-url-new-window-p nil |
13208 | 264 "*If non-nil, always open a new browser window. |
265 Passing an interactive argument to \\[browse-url-netscape] or | |
266 \\[browse-url-cci] reverses the effect of this variable. Requires | |
17443
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
267 Netscape version 1.1N or later or XMosaic version 2.5 or later." |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
268 :type 'boolean |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
269 :group 'browse-url) |
13208 | 270 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
271 (defcustom browse-url-netscape-display nil |
19443 | 272 "*The X display for running Netscape, if not same as Emacs's." |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
273 :type 'string |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
274 :group 'browse-url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
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-mosaic-arguments nil |
02751f3ecbdd
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16670
diff
changeset
|
277 "*A list of strings to pass to Mosaic as arguments." |
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 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
281 (defvar browse-url-path-regexp |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
282 "[^]\t\n \"'()<>[^`{}]*[^]\t\n \"'()<>[^`{}.,;]+" |
19443 | 283 "A regular expression to match the host, path or e-mail part of a URL.") |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
284 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
285 (defvar browse-url-short-regexp |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
286 (concat "[-A-Za-z0-9.]+" browse-url-path-regexp) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
287 "A regular expression probably matching a URL without an access scheme. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
288 Hostname matching is stricter in this case than for |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
289 ``browse-url-regexp''.") |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
290 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
291 (defvar browse-url-regexp |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
292 (concat |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
293 "\\(https?://\\|ftp://\\|gopher://\\|telnet://\\|wais://\\|file:/\\|s?news:\\|mailto:\\)" |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
294 browse-url-path-regexp) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
295 "A regular expression probably matching a complete URL.") |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
296 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
297 (defvar browse-url-markedup-regexp |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
298 "<URL:[^>]+>" |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
299 "A regular expression matching a URL marked up per RFC1738. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
300 This may be broken across lines.") |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
301 |
13208 | 302 (defvar browse-url-filename-alist |
303 '(("^/+" . "file:/")) | |
304 "An alist of (REGEXP . STRING) pairs. | |
305 Any substring of a filename matching one of the REGEXPs is replaced by | |
306 the corresponding STRING. All pairs are applied in the order given. | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
307 The default value prepends `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
|
308 Used by the `browse-url-of-file' command. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
309 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
310 For example, to map EFS filenames to URLs: |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
311 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
312 (setq browse-url-filename-alist |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
313 '((\"/webmaster@webserver:/home/www/html/\" . |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
314 \"http://www.acme.co.uk/\") |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
315 (\"^/+\" . \"file:/\"))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
316 ") |
13208 | 317 |
318 (defvar browse-url-save-file nil | |
319 "If non-nil, save the buffer before displaying its file. | |
320 Used by the `browse-url-of-file' command.") | |
321 | |
322 (defvar browse-url-of-file-hook nil | |
323 "A hook to be run with run-hook after `browse-url-of-file' has asked | |
324 a browser to load a file. | |
325 | |
326 Set this to `browse-url-netscape-reload' to force Netscape to load the | |
327 file rather than displaying a cached copy.") | |
328 | |
329 (defvar browse-url-usr1-signal | |
330 (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
|
331 (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
|
332 '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
|
333 30) ; Check /usr/include/signal.h. |
13208 | 334 "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
|
335 Emacs 19.29 accepts 'SIGUSR1, earlier versions require an integer |
13208 | 336 which is 30 on SunOS and 16 on HP-UX and Solaris.") |
337 | |
338 (defvar browse-url-CCI-port 3003 | |
339 "Port to access XMosaic via CCI. | |
340 This can be any number between 1024 and 65535 but must correspond to | |
341 the value set in the browser.") | |
342 | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
343 (defvar browse-url-CCI-host "localhost" |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
344 "*Host to access XMosaic via CCI. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
345 This should be the host name of the machine running XMosaic with CCI |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
346 enabled. The port number should be set in `browse-url-CCI-port'.") |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
347 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
348 (defvar browse-url-temp-file-name nil) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
349 (make-variable-buffer-local 'browse-url-temp-file-name) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
350 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
351 (defcustom browse-url-xterm-program "xterm" |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
352 "*The name of the terminal emulator used by `browse-url-lynx-xterm'. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
353 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
|
354 :type 'string |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
355 :group 'browse-url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
356 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
357 (defcustom browse-url-xterm-args nil |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
358 "*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
|
359 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
|
360 :type '(repeat (string :tag "Argument")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
361 :group 'browse-url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
362 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
363 (defcustom browse-url-gnudoit-program "gnudoit" |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
364 "*The name of the `gnudoit' program used by `browse-url-w3-gnudoit'." |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
365 :type 'string |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
366 :group 'browse-url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
367 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
368 (defcustom browse-url-gnudoit-args '("-q") |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
369 "*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
|
370 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
|
371 :type '(repeat (string :tag "Argument")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
372 :group 'browse-url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
373 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
374 (defcustom browse-url-generic-program nil |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
375 "*The name of the browser program used by `browse-url-generic'." |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
376 :type 'string |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
377 :group 'browse-url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
378 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
379 (defcustom browse-url-generic-args nil |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
380 "*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
|
381 :type '(repeat (string :tag "Argument")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
382 :group 'browse-url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
383 |
19442 | 384 (defcustom browse-url-temp-dir |
385 (or (getenv "TMPDIR") "/tmp") | |
386 "*The name of a directory in which to store temporary files | |
387 generated by functions like `browse-url-of-region'. You might want to | |
388 set this to somewhere with restricted read permissions for privacy's sake." | |
389 :type 'string | |
390 :group 'browse-url) | |
391 | |
19579
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
392 (defcustom browse-url-netscape-version |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
393 3 |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
394 "*The version of Netscape you are using. |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
395 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
|
396 incompatibly at version 4." |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
397 :type 'number |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
398 :group 'browse-url) |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
399 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
400 (defvar browse-url-temp-file-list '()) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
401 |
13208 | 402 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
403 ;; URL input | |
404 | |
405 (defun browse-url-url-at-point () | |
18611
a3267de991c3
Require thingatpt when compiling.
Richard M. Stallman <rms@gnu.org>
parents:
18253
diff
changeset
|
406 (let ((url (thing-at-point 'url))) |
a3267de991c3
Require thingatpt when compiling.
Richard M. Stallman <rms@gnu.org>
parents:
18253
diff
changeset
|
407 (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
|
408 url)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
409 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
410 ;; 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
|
411 ;; 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
|
412 ;; to switch between browsers. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
413 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
414 (defun browse-url-interactive-arg (prompt) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
415 "Read a URL from the minibuffer, prompting with PROMPT. |
19442 | 416 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
|
417 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
|
418 `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
|
419 negation if a prefix argument was given." |
13208 | 420 (let ((event (elt (this-command-keys) 0))) |
421 (and (listp event) (mouse-set-point event))) | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
422 (list (read-string prompt (browse-url-url-at-point)) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
423 (not (eq (null browse-url-new-window-p) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
424 (null current-prefix-arg))))) |
13208 | 425 |
426 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
427 ;; Browse current buffer | |
428 | |
16416
c7622616333c
(browse-url-at-point): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
16415
diff
changeset
|
429 ;;;###autoload |
13208 | 430 (defun browse-url-of-file (&optional file) |
431 "Ask a WWW browser to display FILE. | |
432 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
|
433 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
|
434 `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
|
435 `browse-url' function then run `browse-url-of-file-hook'." |
13208 | 436 (interactive) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
437 (or file |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
438 (setq file (buffer-file-name)) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
439 (error "Current buffer has no file")) |
13208 | 440 (let ((buf (get-file-buffer file))) |
441 (if buf | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
442 (save-excursion |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
443 (set-buffer buf) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
444 (cond ((not (buffer-modified-p))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
445 (browse-url-save-file (save-buffer)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
446 (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
|
447 (browse-url (browse-url-file-url file)) |
13208 | 448 (run-hooks 'browse-url-of-file-hook)) |
449 | |
450 (defun browse-url-file-url (file) | |
451 "Return the URL corresponding to FILE. | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
452 Use variable `browse-url-filename-alist' to map filenames to URLs. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
453 Convert EFS file names of the form /USER@HOST:PATH to ftp://HOST/PATH." |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
454 ;; URL-encode special chars, do % first |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
455 (let ((s 0)) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
456 (while (setq s (string-match "%" file s)) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
457 (setq file (replace-match "%25" t t file) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
458 s (1+ s)))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
459 (while (string-match "[*\"()',=;? ]" file) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
460 (let ((enc (format "%%%x" (aref file (match-beginning 0))))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
461 (setq file (replace-match enc t t file)))) |
13208 | 462 (let ((maps browse-url-filename-alist)) |
463 (while maps | |
464 (let* ((map (car maps)) | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
465 (from-re (car map)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
466 (to-string (cdr map))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
467 (setq maps (cdr maps)) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
468 (and (string-match from-re file) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
469 (setq file (replace-match to-string t t file)))))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
470 ;; Check for EFS path |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
471 (and (string-match "^/\\([^:@]+@\\)?\\([^:]+\\):/*" file) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
472 (setq file (concat "ftp://" |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
473 (substring file (match-beginning 2) (match-end 2)) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
474 "/" (substring file (match-end 0))))) |
13208 | 475 file) |
476 | |
16416
c7622616333c
(browse-url-at-point): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
16415
diff
changeset
|
477 ;;;###autoload |
13208 | 478 (defun browse-url-of-buffer (&optional buffer) |
479 "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
|
480 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
|
481 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
|
482 narrowed." |
13208 | 483 (interactive) |
484 (save-excursion | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
485 (and buffer (set-buffer buffer)) |
13208 | 486 (let ((file-name |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
487 ;; Ignore real name if restricted |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
488 (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
|
489 (or buffer-file-name |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
490 (and (boundp 'dired-directory) dired-directory))))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
491 (or file-name |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
492 (progn |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
493 (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
|
494 (setq browse-url-temp-file-name |
19442 | 495 (convert-standard-filename |
496 (make-temp-name | |
497 (expand-file-name "burl" browse-url-temp-dir))))) | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
498 (setq file-name browse-url-temp-file-name) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
499 (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
|
500 (browse-url-of-file file-name)))) |
13208 | 501 |
502 (defun browse-url-delete-temp-file (&optional temp-file-name) | |
503 ;; Delete browse-url-temp-file-name from the file system and from | |
504 ;; browse-url-temp-file-list. If optional arg TEMP-FILE-NAME is | |
505 ;; non-nil, delete it instead, but only from the file system -- | |
506 ;; browse-url-temp-file-list is not affected. | |
507 (let ((file-name (or temp-file-name browse-url-temp-file-name))) | |
508 (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
|
509 (progn |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
510 (delete-file file-name) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
511 (if (null temp-file-name) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
512 (setq browse-url-temp-file-list |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
513 (delete browse-url-temp-file-name |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
514 browse-url-temp-file-list))))))) |
13208 | 515 |
516 (defun browse-url-delete-temp-file-list () | |
517 ;; Delete all elements of browse-url-temp-file-list. | |
518 (while browse-url-temp-file-list | |
519 (browse-url-delete-temp-file (car browse-url-temp-file-list)) | |
520 (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
|
521 (cdr browse-url-temp-file-list)))) |
13208 | 522 |
523 (add-hook 'kill-buffer-hook 'browse-url-delete-temp-file) | |
524 (add-hook 'kill-emacs-hook 'browse-url-delete-temp-file-list) | |
525 | |
16416
c7622616333c
(browse-url-at-point): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
16415
diff
changeset
|
526 ;;;###autoload |
13208 | 527 (defun browse-url-of-dired-file () |
528 "In Dired, ask a WWW browser to display the file named on this line." | |
529 (interactive) | |
530 (browse-url-of-file (dired-get-filename))) | |
531 | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
532 ;;;###autoload |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
533 (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
|
534 "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
|
535 (interactive "r") |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
536 (save-excursion |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
537 (save-restriction |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
538 (narrow-to-region (mark) (point)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
539 (browse-url-of-buffer)))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
540 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
541 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
542 ;; Browser-independent commands |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
543 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
544 ;; 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
|
545 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
546 ;;;###autoload |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
547 (defun browse-url (&rest args) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
548 "Ask a WWW browser to load URL. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
549 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
|
550 `browse-url-browser-function' says which browser to use." |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
551 (interactive (browse-url-interactive-arg "URL: ")) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
552 (if (consp browse-url-browser-function) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
553 (browse-url-choose-browser args) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
554 (apply browse-url-browser-function args))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
555 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
556 (defun browse-url-choose-browser (url &rest args) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
557 "Pass URL to a browser function chosen. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
558 This is done according to the association list in variable |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
559 `browse-url-browser-function'." |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
560 (let ((blist browse-url-browser-function) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
561 re bf) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
562 (while (consp blist) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
563 (setq re (car (car blist)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
564 bf (cdr (car blist)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
565 blist (cdr blist)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
566 (if (string-match re url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
567 (progn (apply bf url args) (setq blist t)))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
568 (or blist |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
569 (error "No browser in browse-url-browser-function matching URL %s" url)))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
570 |
16416
c7622616333c
(browse-url-at-point): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
16415
diff
changeset
|
571 ;;;###autoload |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
572 (defun browse-url-at-point () |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
573 "Ask a WWW browser to load the URL at or before point. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
574 Doesn't let you edit the URL like browse-url. Variable |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
575 `browse-url-browser-function' says which browser to use." |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
576 (interactive) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
577 (browse-url (browse-url-url-at-point))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
578 |
17802
77d8356a7eed
(browse-url-event-buffer):
Richard M. Stallman <rms@gnu.org>
parents:
17456
diff
changeset
|
579 (defun browse-url-event-buffer (event) |
77d8356a7eed
(browse-url-event-buffer):
Richard M. Stallman <rms@gnu.org>
parents:
17456
diff
changeset
|
580 (window-buffer (posn-window (event-start event)))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
581 |
17802
77d8356a7eed
(browse-url-event-buffer):
Richard M. Stallman <rms@gnu.org>
parents:
17456
diff
changeset
|
582 (defun browse-url-event-point (event) |
77d8356a7eed
(browse-url-event-buffer):
Richard M. Stallman <rms@gnu.org>
parents:
17456
diff
changeset
|
583 (posn-point (event-start event))) |
13208 | 584 |
16416
c7622616333c
(browse-url-at-point): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
16415
diff
changeset
|
585 ;;;###autoload |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
586 (defun browse-url-at-mouse (event) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
587 "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
|
588 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
|
589 but point is not changed. Doesn't let you edit the URL like |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
590 browse-url. Variable `browse-url-browser-function' says which browser |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
591 to use." |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
592 (interactive "e") |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
593 (save-excursion |
17802
77d8356a7eed
(browse-url-event-buffer):
Richard M. Stallman <rms@gnu.org>
parents:
17456
diff
changeset
|
594 (set-buffer (browse-url-event-buffer event)) |
77d8356a7eed
(browse-url-event-buffer):
Richard M. Stallman <rms@gnu.org>
parents:
17456
diff
changeset
|
595 (goto-char (browse-url-event-point event)) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
596 (let ((url (browse-url-url-at-point))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
597 (if (string-equal url "") |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
598 (error "No URL found")) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
599 (browse-url url)))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
600 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
601 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
602 ;; Browser-specific commands |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
603 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
604 ;; --- Netscape --- |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
605 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
606 (defun browse-url-process-environment () |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
607 "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
|
608 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
|
609 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
|
610 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
|
611 (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
|
612 (if display |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
613 (cons (concat "DISPLAY=" display) process-environment) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
614 process-environment))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
615 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
616 (defun browse-url-emacs-display () |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
617 "Return the X display Emacs is running on. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
618 This nil if the display is the same as the DISPLAY environment variable. |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
619 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
620 Actually Emacs could be using several screens on several displays, as |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
621 listed by (emacs-display-list) and (x-display-screens DISPLAY), this |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
622 just returns the display showing the selected frame. You got a |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
623 problem with that?" |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
624 (let (device display) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
625 (and (fboundp 'selected-device) (fboundp 'device-type) (fboundp 'device-connection) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
626 (setq device (selected-device)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
627 (eq (device-type device) 'x) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
628 (setq display (device-connection device)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
629 (not (equal display (getenv "DISPLAY"))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
630 display))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
631 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
632 ;;;###autoload |
13208 | 633 (defun browse-url-netscape (url &optional new-window) |
634 "Ask the Netscape WWW browser to load URL. | |
635 | |
636 Default to the URL around or before point. The strings in variable | |
637 `browse-url-netscape-arguments' are also passed to Netscape. | |
638 | |
639 When called interactively, if variable `browse-url-new-window-p' is | |
640 non-nil, load the document in a new Netscape window, otherwise use a | |
641 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
|
642 the effect of `browse-url-new-window-p'. |
13208 | 643 |
644 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
|
645 used instead of `browse-url-new-window-p'." |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
646 (interactive (browse-url-interactive-arg "Netscape URL: ")) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
647 ;; URL encode any commas in the URL |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
648 (while (string-match "," url) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
649 (setq url (replace-match "%2C" t t url))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
650 (let* ((process-environment (browse-url-process-environment)) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
651 (process (apply 'start-process |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
652 (concat "netscape " url) nil |
17975
3f2cc6cc8705
(browse-url-netscape, browse-url-netscape-sentinel)
Richard M. Stallman <rms@gnu.org>
parents:
17862
diff
changeset
|
653 browse-url-netscape-program |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
654 (append browse-url-netscape-arguments |
19677
b0f1b44e7a13
(browse-url-netscape): Check for w32 window-system symbol.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19583
diff
changeset
|
655 (if (eq window-system 'w32) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
656 (list url) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
657 (if new-window '("-noraise")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
658 (list "-remote" |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
659 (concat "openURL(" url |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
660 (if new-window ",new-window") |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
661 ")"))))))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
662 (set-process-sentinel process |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
663 (list 'lambda '(process change) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
664 (list 'browse-url-netscape-sentinel 'process url))))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
665 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
666 (defun browse-url-netscape-sentinel (process url) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
667 "Handle a change to the process communicating with Netscape." |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
668 (or (eq (process-exit-status process) 0) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
669 (let* ((process-environment (browse-url-process-environment))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
670 ;; Netscape not running - start it |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
671 (message "Starting Netscape...") |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
672 (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
|
673 browse-url-netscape-program |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
674 (append browse-url-netscape-startup-arguments (list url)))))) |
13208 | 675 |
676 (defun browse-url-netscape-reload () | |
677 "Ask Netscape to reload its current document." | |
678 (interactive) | |
19579
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
679 ;; Backwards incompatibility reported by |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
680 ;; <peter.kruse@psychologie.uni-regensburg.de>. |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
681 (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
|
682 "xfeDoCommand(reload)" |
bbb59d8bca28
Change the custom group to `hypermedia'.
Richard M. Stallman <rms@gnu.org>
parents:
19443
diff
changeset
|
683 "reload"))) |
13208 | 684 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
685 (defun browse-url-netscape-send (command) |
13208 | 686 "Send a remote control command to Netscape." |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
687 (let* ((process-environment (browse-url-process-environment))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
688 (apply 'start-process "netscape" nil |
17975
3f2cc6cc8705
(browse-url-netscape, browse-url-netscape-sentinel)
Richard M. Stallman <rms@gnu.org>
parents:
17862
diff
changeset
|
689 browse-url-netscape-program |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
690 (append browse-url-netscape-arguments |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
691 (list "-remote" command))))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
692 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
693 ;; --- Mosaic --- |
13208 | 694 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
695 ;;;###autoload |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
696 (defun browse-url-mosaic (url &optional new-window) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
697 ;; new-window ignored |
13208 | 698 "Ask the XMosaic WWW browser to load URL. |
699 Default to the URL around or before point." | |
700 (interactive (browse-url-interactive-arg "Mosaic URL: ")) | |
701 (let ((pidfile (expand-file-name "~/.mosaicpid")) | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
702 pid pidbuf) |
13208 | 703 (if (file-readable-p pidfile) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
704 (save-excursion |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
705 (find-file pidfile) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
706 (goto-char (point-min)) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
707 (setq pid (read (current-buffer))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
708 (kill-buffer nil))) |
13208 | 709 (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
|
710 (save-excursion |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
711 (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
|
712 (erase-buffer) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
713 (insert "goto\n" url "\n") |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
714 (save-buffer) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
715 (kill-buffer nil) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
716 ;; Send signal SIGUSR to Mosaic |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
717 (message "Signalling Mosaic...") |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
718 (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
|
719 ;; Or you could try: |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
720 ;; (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
|
721 (message "Signalling Mosaic...done") |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
722 ) |
13208 | 723 ;; Mosaic not running - start it |
724 (message "Starting Mosaic...") | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
725 (apply 'start-process "xmosaic" nil "xmosaic" |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
726 (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
|
727 (message "Starting Mosaic...done")))) |
13208 | 728 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
729 ;; --- Grail --- |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
730 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
731 ;;;###autoload |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
732 (defvar browse-url-grail |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
733 (concat (or (getenv "GRAILDIR") "~/.grail") "/user/rcgrail.py") |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
734 "*Location of Grail remote control client script `rcgrail.py'. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
735 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
|
736 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
737 ;;;###autoload |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
738 (defun browse-url-grail (url &optional new-window) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
739 "Ask the Grail WWW browser to load URL. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
740 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
|
741 variable `browse-url-grail'." |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
742 (interactive (browse-url-interactive-arg "Grail URL: ")) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
743 (message "Sending URL to Grail...") |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
744 (save-excursion |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
745 (set-buffer (get-buffer-create " *Shell Command Output*")) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
746 (erase-buffer) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
747 ;; don't worry about this failing. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
748 (call-process browse-url-grail nil 0 nil url) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
749 (message "Sending URL to Grail... done"))) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
750 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
751 ;; --- Mosaic using CCI --- |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
752 |
13208 | 753 (defun browse-url-cci (url &optional new-window) |
754 "Ask the XMosaic WWW browser to load URL. | |
755 Default to the URL around or before point. | |
756 | |
757 This function only works for XMosaic version 2.5 or later. You must | |
758 select `CCI' from XMosaic's File menu, set the CCI Port Address to the | |
759 value of variable `browse-url-CCI-port', and enable `Accept requests'. | |
760 | |
761 When called interactively, if variable `browse-url-new-window-p' is | |
762 non-nil, load the document in a new browser window, otherwise use a | |
763 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
|
764 the effect of `browse-url-new-window-p'. |
13208 | 765 |
766 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
|
767 used instead of `browse-url-new-window-p'." |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
768 (interactive (browse-url-interactive-arg "Mosaic URL: ")) |
13208 | 769 (open-network-stream "browse-url" " *browse-url*" |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
770 browse-url-CCI-host browse-url-CCI-port) |
13208 | 771 ;; Todo: start browser if fails |
772 (process-send-string "browse-url" | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
773 (concat "get url (" url ") output " |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
774 (if new-window "new" "current") "\r\n")) |
13208 | 775 (process-send-string "browse-url" "disconnect\r\n") |
776 (delete-process "browse-url")) | |
777 | |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
778 ;; --- IXI Mosaic --- |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
779 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
780 ;;;###autoload |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
781 (defun browse-url-iximosaic (url &optional new-window) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
782 ;; new-window ignored |
13208 | 783 "Ask the IXIMosaic WWW browser to load URL. |
784 Default to the URL around or before point." | |
785 (interactive (browse-url-interactive-arg "IXI Mosaic URL: ")) | |
786 (start-process "tellw3b" nil "tellw3b" | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
787 "-service WWW_BROWSER ixi_showurl " url)) |
13208 | 788 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
789 ;; --- W3 --- |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
790 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
791 ;;;###autoload |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
792 (defun browse-url-w3 (url &optional new-window) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
793 ;; new-window ignored |
13208 | 794 "Ask the w3 WWW browser to load URL. |
795 Default to the URL around or before point." | |
796 (interactive (browse-url-interactive-arg "W3 URL: ")) | |
797 (w3-fetch url)) | |
798 | |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
799 ;;;###autoload |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
800 (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
|
801 ;; new-window ignored |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
802 "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
|
803 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
|
804 `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
|
805 (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
|
806 (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
|
807 browse-url-gnudoit-program |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
808 (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
|
809 |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
810 ;; --- Lynx in an xterm --- |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
811 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
812 ;;;###autoload |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
813 (defun browse-url-lynx-xterm (url &optional new-window) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
814 ;; new-window ignored |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
815 "Ask the Lynx WWW browser to load URL. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
816 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
|
817 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
|
818 with possible additional arguments `browse-url-xterm-args'." |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
819 (interactive (browse-url-interactive-arg "Lynx URL: ")) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
820 (apply 'start-process (concat "lynx" url) nil browse-url-xterm-program |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
821 (append browse-url-xterm-args (list "-e" "lynx" url)))) |
16415
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
822 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
823 ;; --- Lynx in an Emacs "term" window --- |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
824 |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
825 ;;;###autoload |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
826 (defun browse-url-lynx-emacs (url &optional new-window) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
827 ;; new-window ignored |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
828 "Ask the Lynx WWW browser to load URL. |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
829 Default to the URL around or before point. Run a new Lynx process in |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
830 an Emacs buffer." |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
831 (interactive (browse-url-interactive-arg "Lynx URL: ")) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
832 (let ((system-uses-terminfo t)) ; Lynx uses terminfo |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
833 (if (fboundp 'make-term) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
834 (let ((term-term-name "vt100")) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
835 (set-buffer (make-term "browse-url" "lynx" nil url)) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
836 (term-mode) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
837 (term-char-mode) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
838 (switch-to-buffer "*browse-url*")) |
e25afe6ea4d6
(browse-url): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15780
diff
changeset
|
839 (terminal-emulator "*browse-url*" "lynx" (list url))))) |
15780
0a03d2b02ba1
(browse-url-choose-browser): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15656
diff
changeset
|
840 |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
841 ;; --- MMM --- |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
842 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
843 ;;;###autoload |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
844 (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
|
845 "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
|
846 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
|
847 (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
|
848 (message "Sending URL to MMM...") |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
849 (save-excursion |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
850 (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
|
851 (erase-buffer) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
852 ;; 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
|
853 (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
|
854 ;; location in v 0.4: |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
855 (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
|
856 (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
|
857 (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
|
858 (message "Sending URL to MMM... done"))) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
859 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
860 ;; --- mailto --- |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
861 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
862 ;;;###autoload |
19583
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
863 (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
|
864 "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
|
865 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
|
866 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
|
867 will cause the mail to be composed in another window rather than the |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
868 current one." |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
869 (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
|
870 (save-excursion |
19583
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
871 (let ((func (if new-window |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
872 'compose-mail-other-window |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
873 'compose-mail)) |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
874 (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
|
875 (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
|
876 url))) |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
877 (apply func |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
878 (list to nil nil nil nil nil (cons 'insert-buffer |
5c7badcafb2b
(browse-url-mail): Use compose-mail[-other-window], not always `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
19579
diff
changeset
|
879 (current-buffer))))))) |
18253
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
880 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
881 ;; --- Random browser --- |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
882 |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
883 ;;;###autoload |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
884 (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
|
885 ;; new-window ignored |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
886 "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
|
887 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
|
888 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
|
889 `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
|
890 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
|
891 (interactive (browse-url-interactive-arg "URL: ")) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
892 (if (not browse-url-generic-program) |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
893 (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
|
894 (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
|
895 browse-url-generic-program |
0c8339d10beb
Update keywords to show up in finder.
Richard M. Stallman <rms@gnu.org>
parents:
18224
diff
changeset
|
896 (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
|
897 |
13208 | 898 (provide 'browse-url) |
899 | |
900 ;;; browse-url.el ends here |