Subject: 25.1.50; Wishlist: Rework how Emacs decides to follow links

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 01 Mar 2016 01:04:01 +1100

When you click on a link, the browse-url-browser-function variable
decides how a link would is to be followed.  When Emacs got its own web
browser, we needed a way to say "but what if I want to open this in
another browser?", so we got the shr-external-browser variable.

This leads to inconsistencies in how we interact with links, especially
when we contemplate doing away with the Info format and using HTML
instead.

What we want is this, I think:  A way to say what the internal browser
is (eww, emacs-w3m, etc), and a way to say what the preferred external
browser is (Firefox, Chrome, etc), and a way to say that we prefer to
use either the external or the internal browser by default.

So here's what I propose: Three new variables.

browse-url-internal-browser
browse-url-external-browser
browse-url-use-internal-browser (which would be nil/non-nil)

All commands that follow links (in all modes) will allow you to choose
whether to use the default or the non-default method.  That is, hitting
`RET' on a link would, if `browse-url-use-internal-browser' is set, open
the link using the internal browser.  `C-u RET' would use the external
browser.

And if it's not set, then `RET' would use the external browser, and `C-u
RET' would use the internal browser.

I think this would be flexible, but completely transparent and
predictable for the user.  Today, if you hit `RET' on a link in erc,
it's going to do something else than if you hit `RET' on a link in an
HTML mail in Gnus.

In GNU Emacs 25.1.50.48 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.7)
 of 2016-02-29 built on mouse
Repository revision: 379a846b8548dc32a9019ef0a37c02f62cd9bad1
Windowing system distributor 'The X.Org Foundation', version 11.0.11702000
System Description:	Ubuntu 15.10

Configured using:
 'configure --with-xwidgets --with-x-toolkit=gtk3'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XWIDGETS

Important settings:
  value of $LC_MONETARY: nb_NO.UTF-8
  value of $LC_NUMERIC: nb_NO.UTF-8
  value of $LC_TIME: nb_NO.UTF-8
  value of $LANG: C
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent messages:
Mark set
Mark saved where search started
Mark set
Mark saved where search started
Making completion list...
Mark saved where search started
Mark set
Mark saved where search started
Mark set
Making completion list...

Load-path shadows:
~/src/emacs/elpa/packages/debbugs/debbugs-org hides /home/larsi/.emacs.d/elpa/debbugs-0.7/debbugs-org
~/src/emacs/elpa/packages/debbugs/debbugs-browse hides /home/larsi/.emacs.d/elpa/debbugs-0.7/debbugs-browse
~/src/emacs/elpa/packages/debbugs/debbugs-gnu hides /home/larsi/.emacs.d/elpa/debbugs-0.7/debbugs-gnu
~/src/emacs/elpa/packages/debbugs/debbugs hides /home/larsi/.emacs.d/elpa/debbugs-0.7/debbugs

Features:
(shadow emacsbug image-mode view pp timezone etags perl-mode flow-fill
eww shell pcomplete comint gnus-html log-edit pcvs-util whitespace
vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs vc-dir ewoc bug-reference
ecomplete mailalias smtpmail sendmail crm edebug pulse help-fns
find-func thingatpt xref project ring misearch multi-isearch vc
vc-dispatcher vc-git diff-mode map url-queue url-cache shr-color color
mm-archive sort smiley ansi-color gnus-cite qp gnus-async gnus-dup
gnus-ml gmane spam-gmane dns mm-url disp-table nndoc gnus-fun gnus-mdrtn
gnus-topic nndraft nnmh utf-7 nnfolder copyright network-stream nsm
starttls nnir spam-report spam spam-stat gnus-uu yenc gnus-agent
gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu
mml2015 mm-view mml-smime smime dig nntp gnus-cache gnus-sum gnus-group
gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc
nnoo parse-time gnus-spec gnus-int gnus-range message format-spec rfc822
mml mml-sec epa epg mailabbrev gmm-utils mailheader gnus-win gnus
nnheader gnus-util rmail rmail-loaddefs mail-utils wid-edit movie mkv
shr svg browse-url imdb dom pvr debug debbugs-gnu easy-mmode derived
subr-x debbugs soap-client mm-decode mm-bodies mm-encode url-http tls
gnutls url-auth mail-parse rfc2231 rfc2047 rfc2045 ietf-drums url-gw
puny url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util mailcap warnings rng-xsd rng-dt rng-util
xsd-regexp xml ido seq flyspell ispell dired dired-loaddefs add-log
mail-extr mm-util mail-prsvr jka-compr cl finder-inf info package
epg-config url-handlers url-parse auth-source cl-seq eieio byte-opt
bytecomp byte-compile cl-extra help-mode easymenu cconv eieio-core
cl-macs gv eieio-loaddefs cl-loaddefs pcase cl-lib password-cache
url-vars time-date mule-util tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev
obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
dbusbind inotify dynamic-setting system-font-setting font-render-setting
xwidget-internal move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 1239345 132112)
 (symbols 48 151151 39)
 (miscs 40 615 2727)
 (strings 32 254878 17581)
 (string-bytes 1 9402816)
 (vectors 16 47199)
 (vector-slots 8 1709029 146158)
 (floats 8 2021 2558)
 (intervals 56 95890 2882)
 (buffers 976 74)
 (heap 1024 240347 119366))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no