From 122eedfad6805add3c19950729e9d877c78fe1de Mon Sep 17 00:00:00 2001 From: mousebot Date: Sun, 13 Feb 2022 14:39:31 +0100 Subject: make mpv an optional dependency - keymap / help-echo are conditional on mpv being installed. - maybe mpv (and company, emojify, etc.) should become hard dependencies... --- lisp/mastodon-tl.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index a1ffb40..e33aadf 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -168,10 +168,11 @@ We need to override the keymap so tabbing will navigate to all types of mastodon links and not just shr.el-generated ones.") (defvar mastodon-tl--byline-link-keymap - (let ((map (make-sparse-keymap))) - (define-key map (kbd "") 'mastodon-tl--mpv-play-video-from-byline) - (keymap-canonicalize map)) - "The keymap to be set for the author byline. + (when (require 'mpv nil :no-error) + (let ((map (make-sparse-keymap))) + (define-key map (kbd "") 'mastodon-tl--mpv-play-video-from-byline) + (keymap-canonicalize map))) + "The keymap to be set for the author byline. The idea is that you can play media without navigating to it.") (defun mastodon-tl--next-tab-item () @@ -343,9 +344,10 @@ image media from the byline." (format-media (when media-types (format " | media: %s" (mapconcat #'identity media-types " ")))) - (format-media-binding (when (or - (member "video" media-types) - (member "gifv" media-types)) + (format-media-binding (when (and (or + (member "video" media-types) + (member "gifv" media-types)) + (require 'mpv nil :no-error)) (format " | C-RET to view with mpv")))) (format "%s" (concat format-faves format-media format-media-binding)))) -- cgit v1.2.3