Goto Address Mode Opens Links in Emacs

Added by to Tools on and tagged · emacs ·

About 1 minutes to read (177 words)

Stealing a Hugo Shortcode for Nikola Choosing a static site generator
Goto Address Mode Opens Links in Emacs
Goto Address Mode Opens Links in Emacs

Use goto-address-mode to make links in Emacs buffers clickable.

Org mode has this nice thing where you can click a link in the buffer to open it in your browser. Turns out that's not some special org-only behavior. It's goto-address-mode, a minor mode that activates URLs and email addresses in the current buffer.

You can manually launch it with M-x goto-address-mode. It might be easier to automatically enable it for certain modes. You do that with a hook.

I want links to be available when reviewing notes and blog posts. Since I write those notes in a number of formats, I should add the hook one of the general major modes. text-mode is a good start.

;; base mode for prose
(add-hook 'text-mode-hook (lambda ()
                           (goto-address-mode)))

Now I can open links from my Markdown and RST files with a click! Or a C-c <RET>.

goto-address-mode key bindings
Key Function Action
C-c <RET> goto-address-at-point Opens the link under point

I might add the hook for prog-mode later, if I find myself wanting to click URLs in source code.