From a5d897e9a31a62555ac96a571818edc201123a97 Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 25 Oct 2021 21:56:53 +0100 Subject: link-hints for notmuch-show-mode --- completion.org | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'completion.org') diff --git a/completion.org b/completion.org index b1c357e..41331e1 100644 --- a/completion.org +++ b/completion.org @@ -473,8 +473,41 @@ (let ((unread-command-events '(?\;))) (link-hint-open-link))) - :bind (("C-c L" . link-hint-open-link) - ("C-c l" . embark-on-link))) + (defun jao-link-hint--notmuch-next-part (&optional bound) + (when-let (p (next-single-property-change (point) :notmuch-part nil bound)) + (and (< p (or bound (point-max))) p))) + + (defun jao-link-hint--notmuch-part-p () + (and (get-text-property (point) :notmuch-part) + (button-label (button-at (point))))) + + (link-hint-define-type 'notmuch-part + :next #'jao-link-hint--notmuch-next-part + :at-point-p #'jao-link-hint--notmuch-part-p + :vars '(notmuch-show-mode) + :open #'push-button + :open-message "Toggled" + :open-multiple t) + + (defun jao-link-hint--notmuch-next-url (&optional bound) + (link-hint--next-property 'w3m-href-anchor bound)) + + (defun jao-link-hint--notmuch-url-at-point () + (get-text-property (point) 'w3m-href-anchor)) + + (link-hint-define-type 'notmuch-w3m-url + :next #'jao-link-hint--notmuch-next-url + :at-point-p #'jao-link-hint--notmuch-url-at-point + :vars '(notmuch-show-mode) + :open #'browse-url + :open-multiple t + :copy #'kill-new) + + (push 'link-hint-notmuch-part link-hint-types) + (push 'link-hint-notmuch-w3m-url link-hint-types) + + :bind (("C-c l" . link-hint-open-link) + ("C-c L" . link-hint-open-multiple-links))) #+end_src * imenu -- cgit v1.2.3