aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-02-23 17:57:35 +0100
committermarty hiatt <martianhiatus@riseup.net>2024-02-23 17:57:35 +0100
commitd66e27be92992a628b27cd630939ed99c36f0cd8 (patch)
treeb668d26aa806bc339117faa99d802ddd98e2bf20 /lisp/mastodon.el
parentd93fb56ef0e29956dc55befff84301b5b4eed548 (diff)
parent96866e176e469811642b66b971f3125f040de5de (diff)
Merge branch 'develop'
Diffstat (limited to 'lisp/mastodon.el')
-rw-r--r--lisp/mastodon.el28
1 files changed, 21 insertions, 7 deletions
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index 9dac1d1..7a04c87 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -97,6 +97,8 @@
(autoload 'mastodon-views--view-instance-description "mastodon-views")
(autoload 'mastodon-views--view-lists "mastodon-views")
(autoload 'mastodon-views--view-scheduled-toots "mastodon-views")
+(autoload 'mastodon-tl--dm-user "mastodon-tl")
+(autoload 'mastodon-tl--scroll-up-command "mastodon-tl")
(autoload 'special-mode "simple")
(defvar mastodon-tl--highlight-current-toot)
@@ -291,7 +293,7 @@ See `mastodon-toot-display-orig-in-reply-buffer'.")
(buffer-list))))) ; catch any other masto buffer
(mastodon-return-credential-account :force)
(if buffer
- (switch-to-buffer buffer)
+ (pop-to-buffer buffer '(display-buffer-same-window))
(mastodon-tl--get-home-timeline)
(message "Loading Mastodon account %s on %s..."
(mastodon-auth--user-acct)
@@ -299,6 +301,11 @@ See `mastodon-toot-display-orig-in-reply-buffer'.")
(defvar mastodon-profile-credential-account nil)
+;; TODO: the get request in mastodon-http--get-response often returns nil
+;; after waking pc from sleep, not sure how to fix, or if just my pc
+;; interestingly it only happens with this function tho.
+;;we have to use :force to update the credential-account object in case things
+;; have been changed via another client.
(defun mastodon-return-credential-account (&optional force)
"Return the CredentialAccount entity.
Either from `mastodon-profile-credential-account' or from the
@@ -310,7 +317,12 @@ FORCE means to fetch from the server and update
nil :silent)))
(if force
(setq mastodon-profile-credential-account
- (eval req))
+ ;; TODO: we should also signal a quit condition after like 5
+ ;; secs here
+ (condition-case nil
+ (eval req)
+ (t ; req fails, return old value
+ mastodon-profile-credential-account)))
(or mastodon-profile-credential-account
(setq mastodon-profile-credential-account
(eval req))))))
@@ -337,7 +349,7 @@ from the server and load anew."
"*mastodon-notifications*")))
(if (and (not force)
(get-buffer buffer))
- (progn (switch-to-buffer buffer)
+ (progn (pop-to-buffer buffer '(display-buffer-same-window))
(mastodon-tl--update))
(message "Loading your notifications...")
(mastodon-tl--init-sync (or buffer-name "notifications")
@@ -435,10 +447,12 @@ Calls `mastodon-tl--get-buffer-type', which see."
(defun mastodon-switch-to-buffer ()
"Switch to a live mastodon buffer."
(interactive)
- (let* ((bufs (mastodon-live-buffers))
- (buf-names (mapcar #'buffer-name bufs))
- (choice (completing-read "Switch to mastodon buffer: "
- buf-names)))
+ (let ((choice (read-buffer
+ "Switch to mastodon buffer: " nil t
+ (lambda (cand)
+ (with-current-buffer
+ (if (stringp cand) cand (car cand))
+ (mastodon-tl--get-buffer-type))))))
(switch-to-buffer choice)))
(defun mastodon-mode-hook-fun ()