First off, you can find my entire current config at https://gitlab.com/mordocai/emacs.d/tree/4cfdfd76368aa687a6277a22161b40624e32b8fe, just in case I miss including something.
I currently have my emacs browser config setup like:
(global-set-key (kbd "<f6> w") 'browse-url-at-point) (setq w3m-coding-system 'utf-8 w3m-file-coding-system 'utf-8 w3m-file-name-coding-system 'utf-8 w3m-input-coding-system 'utf-8 w3m-output-coding-system 'utf-8 w3m-terminal-coding-system 'utf-8 w3m-use-cookies t) (defun browse-url-at-point-firefox () (interactive) (let ((browse-url-browser-function 'browse-url-firefox)) (browse-url-at-point))) (defun browse-url-at-point-default () (interactive) (let ((browse-url-browser-function 'browse-url-default-browser)) (browse-url-at-point))) (global-set-key (kbd "<f6> f") 'browse-url-at-point-firefox) (global-set-key (kbd "<f6> d") 'browse-url-at-point-default) (global-set-key (kbd "<f6> g") (icurry 'browse-url-default-browser "http://www.google.com"))
However, this only works if the link is "written out" like http://www.duckduckgo.com. If the current mode handles links natively (like org mode, gnus article's html view, or elfeed's html rendering) then the display text will be used as the link instead. Something like Google will try to go to http://Google instead of http://www.google.com.
Is it possible to write a function(s) that will allow me to bind it to a key and will actually go to one of the above type of links properly? If so, is it possible to detect which situation is at point and intelligently go to the link? I think I could write this, but I'm not sure how to get the actual link text in the first place.
If there is a package that can do all of this, all the better!