diff options
author | jao <jao@gnu.org> | 2021-10-25 21:56:53 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-10-25 21:56:53 +0100 |
commit | a5d897e9a31a62555ac96a571818edc201123a97 (patch) | |
tree | ec1fb47a5add913149118823ef669c81e9d72d69 | |
parent | 61a5847fff8b59f74e1e70afc34d09b3a4e0eb41 (diff) | |
download | elibs-a5d897e9a31a62555ac96a571818edc201123a97.tar.gz elibs-a5d897e9a31a62555ac96a571818edc201123a97.tar.bz2 |
link-hints for notmuch-show-mode
-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 |