emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r102497: Introduce a new `browse-url-


From: Lars Magne Ingebrigtsen
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102497: Introduce a new `browse-url-mailto-function' variable for mailto: URLs.
Date: Wed, 24 Nov 2010 07:29:06 +0100
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102497
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Wed 2010-11-24 07:29:06 +0100
message:
  Introduce a new `browse-url-mailto-function' variable for mailto: URLs.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/net/browse-url.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2010-11-23 01:26:02 +0000
+++ b/etc/NEWS  2010-11-24 06:29:06 +0000
@@ -317,6 +317,9 @@
 
 ** Archive Mode has basic support to browse 7z archives.
 
+** browse-url has gotten a new variable that is used for mailto: URLs,
+   `browse-url-mailto-function', which defaults to `browse-url-mail'.
+
 ** ERC changes
 
 *** New vars `erc-autojoin-timing' and `erc-autojoin-delay'.

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-11-23 17:36:15 +0000
+++ b/lisp/ChangeLog    2010-11-24 06:29:06 +0000
@@ -1,3 +1,11 @@
+2010-11-24  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * net/browse-url.el (browse-url-browser-function): Revert the
+       default back to the previous value, since the new value broke
+       mailclient.el.
+       (browse-url-mailto-function): New variable for mailto: URLs.
+       (browse-url): Use the new variable for mailto: URLs.
+
 2010-11-23  Stefan Monnier  <address@hidden>
 
        * eshell/esh-cmd.el (eshell-parse-command):

=== modified file 'lisp/net/browse-url.el'
--- a/lisp/net/browse-url.el    2010-11-10 22:27:02 +0000
+++ b/lisp/net/browse-url.el    2010-11-24 06:29:06 +0000
@@ -216,13 +216,13 @@
 
 ;;;###autoload
 (defcustom browse-url-browser-function
-  `(("\\`mailto:"; . browse-url-mail)
-    ("." .
-     ,(cond
-       ((memq system-type '(windows-nt ms-dos cygwin))
-       'browse-url-default-windows-browser)
-       ((memq system-type '(darwin)) 'browse-url-default-macosx-browser)
-       (t 'browse-url-default-browser))))
+  (cond
+   ((memq system-type '(windows-nt ms-dos cygwin))
+    'browse-url-default-windows-browser)
+   ((memq system-type '(darwin))
+    'browse-url-default-macosx-browser)
+   (t
+    'browse-url-default-browser))
   "Function to display the current buffer in a WWW browser.
 This is used by the `browse-url-at-point', `browse-url-at-mouse', and
 `browse-url-of-file' commands.
@@ -265,6 +265,18 @@
   :version "24.1"
   :group 'browse-url)
 
+(defcustom browse-url-mailto-function 'browse-url-mail
+  "Function to display mailto: links.
+This variable uses the same syntax as the
+`browse-url-browser-function' variable.  If the
+`browse-url-mailto-function' variable is nil, that variable will
+be used instead."
+  :type '(choice
+         (function-item :tag "Emacs Mail" :value browse-url-mail)
+         (function-item :tag "None" nil))
+  :version "24.1"
+  :group 'browse-url)
+
 (defcustom browse-url-netscape-program "netscape"
   ;; Info about netscape-remote from Karl Berry.
   "The name by which to invoke Netscape.
@@ -780,22 +792,27 @@
 (defun browse-url (url &rest args)
   "Ask a WWW browser to load URL.
 Prompts for a URL, defaulting to the URL at or before point.  Variable
-`browse-url-browser-function' says which browser to use."
+`browse-url-browser-function' says which browser to use.
+If the URL is a mailto: URL, consult `browse-url-mailto-function'
+first, if that exists."
   (interactive (browse-url-interactive-arg "URL: "))
   (unless (called-interactively-p 'interactive)
     (setq args (or args (list browse-url-new-window-flag))))
-  (let ((process-environment (copy-sequence process-environment)))
+  (let ((process-environment (copy-sequence process-environment))
+       (function (or (and (string-match "\\`mailto:"; url)
+                          browse-url-mailto-function)
+                     browse-url-browser-function)))
     ;; When connected to various displays, be careful to use the display of
     ;; the currently selected frame, rather than the original start display,
     ;; which may not even exist any more.
     (if (stringp (frame-parameter (selected-frame) 'display))
         (setenv "DISPLAY" (frame-parameter (selected-frame) 'display)))
-    (if (and (consp browse-url-browser-function)
-            (not (functionp browse-url-browser-function)))
+    (if (and (consp function)
+            (not (functionp function)))
        ;; The `function' can be an alist; look down it for first match
        ;; and apply the function (which might be a lambda).
        (catch 'done
-         (dolist (bf browse-url-browser-function)
+         (dolist (bf function)
            (when (string-match (car bf) url)
              (apply (cdr bf) url args)
              (throw 'done t)))
@@ -803,7 +820,7 @@
                 url))
       ;; Unbound symbols go down this leg, since void-function from
       ;; apply is clearer than wrong-type-argument from dolist.
-      (apply browse-url-browser-function url args))))
+      (apply function url args))))
 
 ;;;###autoload
 (defun browse-url-at-point (&optional arg)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]