rendered paste body(defvar *urlcount* 5)
(defun get-last-urls (count)
"Build a list of the <count> most recent urls in the buffer"
(let ((urls '()))
(save-excursion
(while (or (< (length urls) count)
(re-search-backward
(rx (group "http://"
(zero-or-more not-newline)
(not (any ";,<> ")))) 0 t))
(add-to-list 'urls (match-string 1))))
urls))
(defun handle-url-select ()
"Open the URL, remap RET, close buffer - this doesn't completely work yet"
(progn
(browse-url (thing-at-point 'url))
(kill-buffer (current-buffer))))
(defun print-urls (*urlcount*)
"Exposed function to open list of urls and allow opening"
(interactive)
(save-excursion
(let ((urls (get-last-urls count))
(bname "*urls*"))
(switch-to-buffer bname)
(erase-buffer)
(local-set-key (kbd "RET") 'handle-url-select)
(dolist (url urls) (insert (url-normalize-url url)))
(goto-char 1))))