app/twitter: add +twitter/ace-link command
This commit is contained in:
parent
daf4c93e36
commit
5a13c436ff
1 changed files with 23 additions and 0 deletions
|
@ -63,3 +63,26 @@ that works with the feature/popup module."
|
||||||
(twittering-rerender-timeline-all buf)
|
(twittering-rerender-timeline-all buf)
|
||||||
(setq-local line-spacing 0.2)
|
(setq-local line-spacing 0.2)
|
||||||
(goto-line 0 buf))))
|
(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))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue