aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-08-22 18:52:59 +0000
committerStefan Monnier2007-08-22 18:52:59 +0000
commit378f9937f10466aab340f81206193c11346cf9c2 (patch)
treeca739d6587750f724cf03fa9cdfa2908ec232dd0
parentea26cc2e3dd9e2c179bba6a249953d53ae99a04b (diff)
downloademacs-378f9937f10466aab340f81206193c11346cf9c2.tar.gz
emacs-378f9937f10466aab340f81206193c11346cf9c2.zip
(browse-url-emacs): New function.
-rw-r--r--etc/NEWS2
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/net/browse-url.el25
3 files changed, 25 insertions, 8 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 63591f40e61..e93c9128991 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -41,6 +41,8 @@ below. Emacs tries to warn you about these through `bad-packages-alist'.
41 41
42* Changes in Emacs 22.2 42* Changes in Emacs 22.2
43 43
44** `browse-url-emacs' loads a URL into an Emacs buffer. Handy for *.el URLs.
45
44** `bad-packages-alist' will warn about external packages that are known 46** `bad-packages-alist' will warn about external packages that are known
45to cause problems in this version of Emacs. 47to cause problems in this version of Emacs.
46 48
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 593a390b91a..a3a70d624cf 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12007-08-22 Johan Bockg,Ae(Brd <bojohan@dd.chalmers.se>
2
3 * net/browse-url.el (browse-url-emacs): New function.
4
12007-08-22 Stefan Monnier <monnier@iro.umontreal.ca> 52007-08-22 Stefan Monnier <monnier@iro.umontreal.ca>
2 6
3 * emacs-lisp/bytecomp.el (byte-compile-from-buffer): Display a big fat 7 * emacs-lisp/bytecomp.el (byte-compile-from-buffer): Display a big fat
@@ -938,7 +942,7 @@
938 * lpr.el (lpr-page-header-switches): Move %s to separate element 942 * lpr.el (lpr-page-header-switches): Move %s to separate element
939 for correct quoting. Doc fix. 943 for correct quoting. Doc fix.
940 944
9412007-06-13 Johan Bockg,Ae(Brd <bojohan@dd.chalmers.se> (tiny change) 9452007-06-13 Johan Bockg,Ae(Brd <bojohan@dd.chalmers.se>
942 946
943 * term/xterm.el (terminal-init-xterm): Escape parens in character 947 * term/xterm.el (terminal-init-xterm): Escape parens in character
944 constants. 948 constants.
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 208e1fc178a..55d8d6609e0 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -669,8 +669,7 @@ interactively. Turn the filename into a URL with function
669 (error "Current buffer has no file")) 669 (error "Current buffer has no file"))
670 (let ((buf (get-file-buffer file))) 670 (let ((buf (get-file-buffer file)))
671 (if buf 671 (if buf
672 (save-excursion 672 (with-current-buffer buf
673 (set-buffer buf)
674 (cond ((not (buffer-modified-p))) 673 (cond ((not (buffer-modified-p)))
675 (browse-url-save-file (save-buffer)) 674 (browse-url-save-file (save-buffer))
676 (t (message "%s modified since last save" file)))))) 675 (t (message "%s modified since last save" file))))))
@@ -1171,6 +1170,20 @@ used instead of `browse-url-new-window-flag'."
1171 (append browse-url-epiphany-startup-arguments (list url)))))) 1170 (append browse-url-epiphany-startup-arguments (list url))))))
1172 1171
1173;;;###autoload 1172;;;###autoload
1173(defun browse-url-emacs (url &optional new-window)
1174 "Ask Emacs to load URL into a buffer and show it in another window."
1175 (interactive (browse-url-interactive-arg "URL: "))
1176 (require 'url-handlers)
1177 (let ((file-name-handler-alist
1178 (cons (cons url-handler-regexp 'url-file-handler)
1179 file-name-handler-alist)))
1180 ;; Ignore `new-window': with all other browsers the URL is always shown
1181 ;; in another window than the current Emacs one since it's shown in
1182 ;; another application's window.
1183 ;; (if new-window (find-file-other-window url) (find-file url))
1184 (find-file-other-window url)))
1185
1186;;;###autoload
1174(defun browse-url-gnome-moz (url &optional new-window) 1187(defun browse-url-gnome-moz (url &optional new-window)
1175 "Ask Mozilla/Netscape to load URL via the GNOME program `gnome-moz-remote'. 1188 "Ask Mozilla/Netscape to load URL via the GNOME program `gnome-moz-remote'.
1176Default to the URL around or before point. The strings in variable 1189Default to the URL around or before point. The strings in variable
@@ -1257,8 +1270,7 @@ Default to the URL around or before point. Runs the program in the
1257variable `browse-url-grail'." 1270variable `browse-url-grail'."
1258 (interactive (browse-url-interactive-arg "Grail URL: ")) 1271 (interactive (browse-url-interactive-arg "Grail URL: "))
1259 (message "Sending URL to Grail...") 1272 (message "Sending URL to Grail...")
1260 (save-excursion 1273 (with-current-buffer (get-buffer-create " *Shell Command Output*")
1261 (set-buffer (get-buffer-create " *Shell Command Output*"))
1262 (erase-buffer) 1274 (erase-buffer)
1263 ;; don't worry about this failing. 1275 ;; don't worry about this failing.
1264 (if (browse-url-maybe-new-window new-window) 1276 (if (browse-url-maybe-new-window new-window)
@@ -1428,8 +1440,7 @@ used instead of `browse-url-new-window-flag'."
1428Default to the URL around or before point." 1440Default to the URL around or before point."
1429 (interactive (browse-url-interactive-arg "MMM URL: ")) 1441 (interactive (browse-url-interactive-arg "MMM URL: "))
1430 (message "Sending URL to MMM...") 1442 (message "Sending URL to MMM...")
1431 (save-excursion 1443 (with-current-buffer (get-buffer-create " *Shell Command Output*")
1432 (set-buffer (get-buffer-create " *Shell Command Output*"))
1433 (erase-buffer) 1444 (erase-buffer)
1434 ;; mmm_remote just SEGVs if the file isn't there... 1445 ;; mmm_remote just SEGVs if the file isn't there...
1435 (if (or (file-exists-p (expand-file-name "~/.mmm_remote")) 1446 (if (or (file-exists-p (expand-file-name "~/.mmm_remote"))
@@ -1507,5 +1518,5 @@ Default to the URL around or before point."
1507 1518
1508(provide 'browse-url) 1519(provide 'browse-url)
1509 1520
1510;;; arch-tag: d2079573-5c06-4097-9598-f550fba19430 1521;; arch-tag: d2079573-5c06-4097-9598-f550fba19430
1511;;; browse-url.el ends here 1522;;; browse-url.el ends here