Subject: bug#4300: 23.1.50; bad function name: browse-url-default-browser

From: Lawrence Mitchell <[email-masked]>
Date: Wed, 13 Jul 2011 09:12:38 +0100

Leo wrote:
> On 2011-07-13 05:37 +0800, Lars Magne Ingebrigtsen wrote:
>> I think the function name is clear enough, and renaming it would
>> introduce churn for little extra gain, so I'm closing this report.

> Lars,

> The function name is misleading in that it does not find the default
> browser on the OS to open url. For example, on OSX, it opens up an
> xterm, which is ridiculous to most OSX users.

> Changing a function name to better introduces no churn and helps 3rd
> party developers improve their code.

How about this patch, which doesn't change the name, but does stop
it from lying.  It also removes the (unnecessary, and indeed
incorrect) implementation description from
browse-url-default-browser.

diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index ac12030..e18b42a 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -214,13 +214,7 @@
 
 ;;;###autoload
 (defcustom browse-url-browser-function
-  (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))
+  '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.
@@ -908,12 +902,13 @@ a random existing one.  A non-nil interactive prefix argument reverses
 the effect of `browse-url-new-window-flag'.
 
 When called non-interactively, optional second argument NEW-WINDOW is
-used instead of `browse-url-new-window-flag'.
-
-The order attempted is gnome-moz-remote, Mozilla, Firefox,
-Galeon, Konqueror, Netscape, Mosaic, Lynx in an xterm, and then W3."
+used instead of `browse-url-new-window-flag'."
   (apply
    (cond
+    ((memq system-type '(windows-nt ms-dos cygwin))
+     'browse-url-default-windows-browser)
+    ((memq system-type '(darwin))
+     'browse-url-default-macosx-browser)
     ((browse-url-can-use-xdg-open) 'browse-url-xdg-open)
     ((executable-find browse-url-gnome-moz-program) 'browse-url-gnome-moz)
     ((executable-find browse-url-mozilla-program) 'browse-url-mozilla)

-- 
Lawrence Mitchell <[email-masked]>