aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2010-11-24 07:29:06 +0100
committerLars Magne Ingebrigtsen2010-11-24 07:29:06 +0100
commit876d1684cf36bc9c38b45fa5e6c700944233c56b (patch)
treed76b7b06a2bfdc077e68a338210f4111d2c2c50b
parent4b8b6f602a2a006f4a1a8257e1110eb3d3d8bb1b (diff)
downloademacs-876d1684cf36bc9c38b45fa5e6c700944233c56b.tar.gz
emacs-876d1684cf36bc9c38b45fa5e6c700944233c56b.zip
Introduce a new `browse-url-mailto-function' variable for mailto: URLs.
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/net/browse-url.el43
3 files changed, 41 insertions, 13 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 353b3db4e93..5e16f45530f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -317,6 +317,9 @@ Just set shell-dir-cookie-re to an appropriate regexp.
317 317
318** Archive Mode has basic support to browse 7z archives. 318** Archive Mode has basic support to browse 7z archives.
319 319
320** browse-url has gotten a new variable that is used for mailto: URLs,
321 `browse-url-mailto-function', which defaults to `browse-url-mail'.
322
320** ERC changes 323** ERC changes
321 324
322*** New vars `erc-autojoin-timing' and `erc-autojoin-delay'. 325*** New vars `erc-autojoin-timing' and `erc-autojoin-delay'.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c29cd080c03..6936c2ad17d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12010-11-24 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * net/browse-url.el (browse-url-browser-function): Revert the
4 default back to the previous value, since the new value broke
5 mailclient.el.
6 (browse-url-mailto-function): New variable for mailto: URLs.
7 (browse-url): Use the new variable for mailto: URLs.
8
12010-11-23 Stefan Monnier <monnier@iro.umontreal.ca> 92010-11-23 Stefan Monnier <monnier@iro.umontreal.ca>
2 10
3 * eshell/esh-cmd.el (eshell-parse-command): 11 * eshell/esh-cmd.el (eshell-parse-command):
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 1e653f6708d..35b70ffefb5 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -216,13 +216,13 @@
216 216
217;;;###autoload 217;;;###autoload
218(defcustom browse-url-browser-function 218(defcustom browse-url-browser-function
219 `(("\\`mailto:" . browse-url-mail) 219 (cond
220 ("." . 220 ((memq system-type '(windows-nt ms-dos cygwin))
221 ,(cond 221 'browse-url-default-windows-browser)
222 ((memq system-type '(windows-nt ms-dos cygwin)) 222 ((memq system-type '(darwin))
223 'browse-url-default-windows-browser) 223 'browse-url-default-macosx-browser)
224 ((memq system-type '(darwin)) 'browse-url-default-macosx-browser) 224 (t
225 (t 'browse-url-default-browser)))) 225 'browse-url-default-browser))
226 "Function to display the current buffer in a WWW browser. 226 "Function to display the current buffer in a WWW browser.
227This is used by the `browse-url-at-point', `browse-url-at-mouse', and 227This is used by the `browse-url-at-point', `browse-url-at-mouse', and
228`browse-url-of-file' commands. 228`browse-url-of-file' commands.
@@ -265,6 +265,18 @@ regexp should probably be \".\" to specify a default browser."
265 :version "24.1" 265 :version "24.1"
266 :group 'browse-url) 266 :group 'browse-url)
267 267
268(defcustom browse-url-mailto-function 'browse-url-mail
269 "Function to display mailto: links.
270This variable uses the same syntax as the
271`browse-url-browser-function' variable. If the
272`browse-url-mailto-function' variable is nil, that variable will
273be used instead."
274 :type '(choice
275 (function-item :tag "Emacs Mail" :value browse-url-mail)
276 (function-item :tag "None" nil))
277 :version "24.1"
278 :group 'browse-url)
279
268(defcustom browse-url-netscape-program "netscape" 280(defcustom browse-url-netscape-program "netscape"
269 ;; Info about netscape-remote from Karl Berry. 281 ;; Info about netscape-remote from Karl Berry.
270 "The name by which to invoke Netscape. 282 "The name by which to invoke Netscape.
@@ -780,22 +792,27 @@ narrowed."
780(defun browse-url (url &rest args) 792(defun browse-url (url &rest args)
781 "Ask a WWW browser to load URL. 793 "Ask a WWW browser to load URL.
782Prompts for a URL, defaulting to the URL at or before point. Variable 794Prompts for a URL, defaulting to the URL at or before point. Variable
783`browse-url-browser-function' says which browser to use." 795`browse-url-browser-function' says which browser to use.
796If the URL is a mailto: URL, consult `browse-url-mailto-function'
797first, if that exists."
784 (interactive (browse-url-interactive-arg "URL: ")) 798 (interactive (browse-url-interactive-arg "URL: "))
785 (unless (called-interactively-p 'interactive) 799 (unless (called-interactively-p 'interactive)
786 (setq args (or args (list browse-url-new-window-flag)))) 800 (setq args (or args (list browse-url-new-window-flag))))
787 (let ((process-environment (copy-sequence process-environment))) 801 (let ((process-environment (copy-sequence process-environment))
802 (function (or (and (string-match "\\`mailto:" url)
803 browse-url-mailto-function)
804 browse-url-browser-function)))
788 ;; When connected to various displays, be careful to use the display of 805 ;; When connected to various displays, be careful to use the display of
789 ;; the currently selected frame, rather than the original start display, 806 ;; the currently selected frame, rather than the original start display,
790 ;; which may not even exist any more. 807 ;; which may not even exist any more.
791 (if (stringp (frame-parameter (selected-frame) 'display)) 808 (if (stringp (frame-parameter (selected-frame) 'display))
792 (setenv "DISPLAY" (frame-parameter (selected-frame) 'display))) 809 (setenv "DISPLAY" (frame-parameter (selected-frame) 'display)))
793 (if (and (consp browse-url-browser-function) 810 (if (and (consp function)
794 (not (functionp browse-url-browser-function))) 811 (not (functionp function)))
795 ;; The `function' can be an alist; look down it for first match 812 ;; The `function' can be an alist; look down it for first match
796 ;; and apply the function (which might be a lambda). 813 ;; and apply the function (which might be a lambda).
797 (catch 'done 814 (catch 'done
798 (dolist (bf browse-url-browser-function) 815 (dolist (bf function)
799 (when (string-match (car bf) url) 816 (when (string-match (car bf) url)
800 (apply (cdr bf) url args) 817 (apply (cdr bf) url args)
801 (throw 'done t))) 818 (throw 'done t)))
@@ -803,7 +820,7 @@ Prompts for a URL, defaulting to the URL at or before point. Variable
803 url)) 820 url))
804 ;; Unbound symbols go down this leg, since void-function from 821 ;; Unbound symbols go down this leg, since void-function from
805 ;; apply is clearer than wrong-type-argument from dolist. 822 ;; apply is clearer than wrong-type-argument from dolist.
806 (apply browse-url-browser-function url args)))) 823 (apply function url args))))
807 824
808;;;###autoload 825;;;###autoload
809(defun browse-url-at-point (&optional arg) 826(defun browse-url-at-point (&optional arg)