4

Assume that in the current buffer there is some text like http://emacs.stackexchange.com/. Is it possible to customize Emacs so that double clicking on this text, results in visiting the link by the deafult browser? (i.e., like hyperref in LaTeX).

Name
  • 7,689
  • 4
  • 38
  • 84
  • 1
    Is using mouse mandatory? `M-x ffap`, with point on the link, does what you want. You can bind `ffap` to double click with `(global-set-key [double-mouse-1] 'ffap)`. – giordano Jan 06 '15 at 13:18
  • @giordano Thank you very much. Please feel free to put your comment as an answer in order that I can acknowledge your help within site. – Name Jan 06 '15 at 13:25
  • Please do some basic background research before posting. A [google search for "emacs web link"](https://www.google.com/?gws_rd=ssl#q=emacs+web+link) turns up the [EmacsWiki page for `browse-url`](http://www.emacswiki.org/emacs/BrowseUrl) and the [Emacs manual on external links](http://www.gnu.org/software/emacs/manual/html_node/org/External-links.html) from `org-mode` as the first two hits. – Dan Jan 06 '15 at 13:26

1 Answers1

3

M-x ffap RET does what you want (will be requested a confirmation though). You can bind it to double mouse click with

(global-set-key [double-mouse-1] 'ffap)

As the name suggests, ffap finds files at point, not just URLs. If you want a function tailored to URLs look at the builtin browse-url package (as suggested by Dan), which also lets you choose the browser to use. If you prefer browse-url, replace ffap with browse-url (or browse-url-at-point if you don't want to be prompted for confirmation, thanks glucas!) in the previous code to bind it to double click event.

giordano
  • 3,245
  • 13
  • 19