diff options
-rw-r--r-- | custom/jao-custom-completion.el | 20 | ||||
-rw-r--r-- | custom/jao-custom-gnus.el | 10 |
2 files changed, 14 insertions, 16 deletions
diff --git a/custom/jao-custom-completion.el b/custom/jao-custom-completion.el index c36dd85..c8966e1 100644 --- a/custom/jao-custom-completion.el +++ b/custom/jao-custom-completion.el @@ -262,17 +262,15 @@ (cons 'url lnk) (cons 'org-link (match-string-no-properties 0))))))) -;; (embark-define-keymap jao-embark-targets-org-link-map -;; "Actions for org links" -;; ((kbd "RET") org-open-link-from-string)) - (defun jao-embark-targets--gl-org-link () (when (org-in-regexp org-link-bracket-re) (cons 'gl-org-link (match-string-no-properties 0)))) -;; (embark-define-keymap jao-embark-targets-gl-org-link-map -;; "Actions for exteranl org links" -;; ((kbd "RET") org-open-at-point-global)) +(defvar jao-embark-targets-gl-org-link-map + (define-keymap "RET" #'org-open-at-point-global)) + +(defvar jao-embark-targets-org-link-map + (define-keymap "RET" #'org-open-link-from-string)) (add-to-list 'embark-target-finders #'jao-embark-targets--gl-org-link) (add-to-list 'embark-keymap-alist @@ -342,11 +340,9 @@ (interactive "sURL: ") (jao-embark-targets--play-video "vlc" url)) -;; (embark-define-keymap jao-embark-targets-video-url-map -;; "Actions on URLs pointing to remote video streams." -;; :parent embark-url-map -;; ("v" jao-embark-targets-vlc) -;; ("RET" jao-embark-targets-mpv)) +(defvar jao-embark-targets-video-url-map + (define-keymap "v" #'jao-embark-targets-mpv "RET" #'jao-embark-targets-mpv) + "Actions on URLs pointing to remote video streams.") (add-to-list 'embark-transformer-alist '(url . jao-embark-targets--refine-url)) (add-to-list 'embark-keymap-alist '(video-url . jao-embark-targets-video-url-map)) diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el index e21286a..164257b 100644 --- a/custom/jao-custom-gnus.el +++ b/custom/jao-custom-gnus.el @@ -586,10 +586,12 @@ (gnus-summary-select-article-buffer) (save-excursion (goto-char (point-min)) - (when (search-forward "Enclosure:") - (forward-char 2) - (when-let ((url (thing-at-point-url-at-point))) - (jao-mpc-add-or-play-url url)))))) + (let ((offset (or (and (search-forward-regexp "^Enclosure: " nil t) 2) + (and (search-forward-regexp "^Enclosure$" nil t) -2)))) + (when offset (forward-char offset)) + (if-let ((url (jao-url-around-point))) + (jao-mpc-add-or-play-url url) + (error "No enclosure found")))))) ;;;; delayed messages (require 'gnus-util) |