As most of you know, I do almost all my writing in Org mode so I’m used to being able to follow a URL by typing return on it or with Ctrl+c Ctrl+o. I use this all the time and, occasionally, when I’m in some other type of buffer I’ll try to follow the link and it won’t work. I end up copying the link and pasting it into my browser. That’s a real cache miss for me.
I just had another of those “how did I not know this” moments when I saw Álvaro Ramírez’s post about enabling the exact functionality I wanted. It’s been there all along. I’m not sure when it was integrated into Emacs core but the creation date on the source file is 1995.
Don’t let Ramírez’s use of use-package
mislead you. It’s not a third-party package; it’s built into Emacs. On the other hand, Ramírez’s use-package
invocation is useful because it shows you how to set it up. For most buffer types, you’ll want to use goto-address-mode
but for code you’ll probably want goto-address-prog-mode
which behaves the same as goto-address-mode
but only for strings and comments. If you use Org buffers much of the time, you may want to bind Ctrl+c Ctrl+o instead of or in addition to Return.
This is a great find for me. I don’t need it that often but it was really annoying when I did and I didn’t know the easy way of doing it. Thanks to Ramírez for the tip. Perhaps you’ll find it useful too.