Skip to content

Commit

Permalink
Update ace-link-gnus for Emacs 27.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kljohann authored and abo-abo committed Jan 21, 2021
1 parent 4345b93 commit a0e426d
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions ace-link.el
Original file line number Diff line number Diff line change
Expand Up @@ -427,30 +427,35 @@ If EXTERNAL is double prefix, browse in new buffer."
(defun ace-link--gnus-action (pt)
(when (number-or-marker-p pt)
(goto-char (1+ pt))
(widget-button-press (point))))

(declare-function widget-forward "wid-edit")
(declare-function gnus-summary-widget-forward "gnus-sum")
(declare-function widget-button-press "wid-edit")
(cond ((< emacs-major-version 27)
(widget-button-press (point)))
((and (eq mm-text-html-renderer 'shr)
(get-text-property (point) 'shr-url))
(shr-browse-url))
((get-text-property (point) 'gnus-callback)
(gnus-article-press-button))
(t (push-button)))))

(defun ace-link--gnus-collect ()
"Collect the positions of visible links in the current gnus buffer."
(require 'wid-edit)
(let (candidates pt)
(save-excursion
(save-restriction
(narrow-to-region
(window-start)
(window-end))
(goto-char (point-min))
(setq pt (point))
(while (progn (widget-forward 1)
(> (point) pt))
(if (<= 27 emacs-major-version)
(mapcar #'cdr (ace-link--woman-collect))
(require 'wid-edit)
(let (candidates pt)
(save-excursion
(save-restriction
(narrow-to-region
(window-start)
(window-end))
(goto-char (point-min))
(setq pt (point))
(when (or (plist-get (text-properties-at (point)) 'gnus-string)
(plist-get (text-properties-at (point)) 'shr-url))
(push (point) candidates)))
(nreverse candidates)))))
(while (progn (widget-forward 1)
(> (point) pt))
(setq pt (point))
(when (or (plist-get (text-properties-at (point)) 'gnus-string)
(plist-get (text-properties-at (point)) 'shr-url))
(push (point) candidates)))
(nreverse candidates))))))

;;* Helper functions for `ace-link-mu4e' and `ace-link-notmuch'
(defun ace-link--email-view-plain-collect ()
Expand Down

0 comments on commit a0e426d

Please sign in to comment.