diff --git a/modules/app/twitter/autoload.el b/modules/app/twitter/autoload.el index 54267d3d9..883390363 100644 --- a/modules/app/twitter/autoload.el +++ b/modules/app/twitter/autoload.el @@ -63,3 +63,26 @@ that works with the feature/popup module." (twittering-rerender-timeline-all buf) (setq-local line-spacing 0.2) (goto-line 0 buf)))) + +;;;###autoload +(defun +twitter/ace-link () + "Open a visible link, username or hashtag in a `twittering-mode' buffer." + (interactive) + (let ((pt (avy-with +twitter/ace-link + (avy--process + (+twitter--collect-links) + (avy--style-fn avy-style))))) + (when (number-or-marker-p pt) + (goto-char pt) + (let ((uri (get-text-property (point) 'uri))) + (if uri (browse-url uri)))))) + +(defun +twitter--collect-links () + (let ((end (window-end)) + points) + (save-excursion + (goto-char (window-start)) + (while (and (< (point) end) + (ignore-errors (twittering-goto-next-thing) t)) + (push (point) points)) + (nreverse points))))