diff options
-rw-r--r-- | completion.org | 37 |
1 files changed, 35 insertions, 2 deletions
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 |