I would just use a macro.
Emacs
A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!
Get Emacs
Rules
- Posts should be emacs related
- Be kind please
- Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.
Emacs Resources
Emacs Tutorials
- Beginner’s Guide to Emacs
- Absolute Beginner's Guide to Emacs
- How to Learn Emacs: A Hand-drawn One-pager for Beginners
Useful Emacs configuration files and distributions
Quick pain-saver tip
Assuming that you are referring to plain text...
while keeping them as clickable links
First of all you need to establish why a plain text URL is doing something when you click on it, as your new requirement is going to need to interact with that.
(I'm guessing goto-address-mode
is enabled, so I would check that first.)
never heard of goto-address-mode, seems cool
you can do this with an Overlay, if you know where the link starts and ends. For example I have the buffer README.org
#+title: hypop - emacs minibuffer-frame + hyprland
* Demo
https://www.youtube.com/watch?v=jXRt598HqCY
the first character of the link is the 60th and the last is the 103rd. So I could write
(with-current-buffer "README.org"
(overlay-put (make-overlay 60 103) 'display "link"))
Clicking the "link" text still opens YouTube as expected.
To do this all over a buffer you'd want to add a font-lock
rule based on a regular expression like browse-url-button-regexp
.
If you only need it in Org files, there's probably some machinery to facilitate that as well
Hyperbole’s ebut:program function lets you create explicitly named buttons that look like <(link)> in place if your long URLs.