aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-toot.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-03-17 14:06:58 +0100
committermarty hiatt <martianhiatus@riseup.net>2024-03-17 14:08:11 +0100
commit7df610ba70be4349db418c901af33fdf126997bb (patch)
tree7b4b69ba15120aa321b4c17b006d372e5c46bc4e /lisp/mastodon-toot.el
parent93452494d1d0437487d7094c8ccdf6cdb47bb8c4 (diff)
condition case for lingva translations
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r--lisp/mastodon-toot.el22
1 files changed, 12 insertions, 10 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 47bda3f..062eaf0 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -549,16 +549,18 @@ base toot."
"Translate text of toot at point.
Uses `lingva.el'."
(interactive)
- (if (not (require 'lingva nil :no-error))
- (message "Looks like you need to install lingva.el first.")
- (if mastodon-tl--buffer-spec
- (if-let ((toot (mastodon-tl--property 'item-json)))
- (lingva-translate nil
- (mastodon-tl--content toot)
- (when mastodon-tl--enable-proportional-fonts
- t))
- (message "No toot to translate?"))
- (message "No mastodon buffer?"))))
+ (if mastodon-tl--buffer-spec
+ (if-let ((toot (mastodon-tl--property 'item-json)))
+ (condition-case x
+ (lingva-translate nil
+ (mastodon-tl--content toot)
+ (when mastodon-tl--enable-proportional-fonts
+ t))
+ (void-function
+ (message "Looks like you need to install lingva.el. Error: %s"
+ (error-message-string x))))
+ (message "No toot to translate?"))
+ (message "No mastodon buffer?")))
(defun mastodon-toot--own-toot-p (toot)
"Check if TOOT is user's own, for deleting, editing, or pinning it."