aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2022-02-13 14:39:31 +0100
committermousebot <mousebot@riseup.net>2022-02-13 14:39:31 +0100
commit122eedfad6805add3c19950729e9d877c78fe1de (patch)
treee98e31e7b937abf7fb04cb2c2275aa6397b09a54
parentf4f1ef4ad2622ec5c8cd5fe49298b8e317a0a763 (diff)
make mpv an optional dependency
- keymap / help-echo are conditional on mpv being installed. - maybe mpv (and company, emojify, etc.) should become hard dependencies...
-rw-r--r--lisp/mastodon-tl.el16
1 files 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 "<C-return>") '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 "<C-return>") '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))))