aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2021-06-07 17:09:10 +0200
committermousebot <mousebot@riseup.net>2021-06-07 17:14:15 +0200
commitaf3705d107a248c1edc0742f6a8533bef533b6a5 (patch)
tree5ea005e69c4df8be1981e6b7765858a6205df5cd /lisp/mastodon.el
parent93a5c652a97f2b591c32ec4902bbc24781b9a9d7 (diff)
only get-home-timeline if mastodon buffers not already open.
requires cl-lib
Diffstat (limited to 'lisp/mastodon.el')
-rw-r--r--lisp/mastodon.el17
1 files changed, 15 insertions, 2 deletions
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index c1c4360..50acc18 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -30,6 +30,8 @@
;; it is a labor of love.
;;; Code:
+(require 'cl-lib) ; for some call in mastodon
+
(declare-function discover-add-context-menu "discover")
(declare-function emojify-mode "emojify")
(declare-function request "request")
@@ -180,8 +182,19 @@ Use. e.g. \"%c\" for your locale's date and time format."
(defun mastodon ()
"Connect Mastodon client to `mastodon-instance-url' instance."
(interactive)
- (mastodon-tl--get-home-timeline)
- (message "Loading Mastodon account %s on %s..." (mastodon-auth--get-account-name) mastodon-instance-url))
+ (let* ((tls (list "home"
+ "local"
+ "federated"
+ (concat (mastodon-auth--get-account-name) "-statuses") ; profile
+ "favourites"
+ "search"))
+ (buffer (cl-some (lambda (el)
+ (get-buffer (concat "*mastodon-" el "*")))
+ tls))) ; return first buff that exists
+ (if buffer
+ (switch-to-buffer buffer)
+ (mastodon-tl--get-home-timeline)
+ (message "Loading Mastodon account %s on %s..." (mastodon-auth--get-account-name) mastodon-instance-url))))
;;;###autoload
(defun mastodon-toot (&optional user reply-to-id)