diff options
Diffstat (limited to 'lisp/mastodon-views.el')
-rw-r--r-- | lisp/mastodon-views.el | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/lisp/mastodon-views.el b/lisp/mastodon-views.el index 8064282..4f102a6 100644 --- a/lisp/mastodon-views.el +++ b/lisp/mastodon-views.el @@ -36,8 +36,12 @@ (require 'cl-lib) (require 'mastodon-http) +(eval-when-compile + (require 'mastodon-tl)) (defvar mastodon-mode-map) +(defvar mastodon-tl--horiz-bar) +(defvar mastodon-tl--timeline-posts-count) (autoload 'mastodon-mode "mastodon") (autoload 'mastodon-tl--init "mastodon-tl") @@ -797,30 +801,22 @@ INSTANCE is the instance were are working with." (let* ((domain (url-file-nondirectory instance)) (buf (get-buffer-create (format "*mastodon-instance-%s*" domain)))) - (with-current-buffer buf - (switch-to-buffer-other-window buf) - (let ((inhibit-read-only t)) - (erase-buffer) - (special-mode) - (when brief - (setq response - (list (assoc 'uri response) - (assoc 'title response) - (assoc 'short_description response) - (assoc 'email response) - (cons 'contact_account - (list - (assoc 'username - (assoc 'contact_account response)))) - (assoc 'rules response) - (assoc 'stats response)))) - (mastodon-views--print-json-keys response) - ;; (mastodon-mode) ; breaks our 'q' binding that avoids leaving - ;; split window - (mastodon-tl--set-buffer-spec (buffer-name buf) - "instance" - nil) - (goto-char (point-min))))))) + (with-mastodon-buffer buf #'special-mode :other-window + (when brief + (setq response + (list (assoc 'uri response) + (assoc 'title response) + (assoc 'short_description response) + (assoc 'email response) + (cons 'contact_account + (list + (assoc 'username + (assoc 'contact_account response)))) + (assoc 'rules response) + (assoc 'stats response)))) + (mastodon-views--print-json-keys response) + (mastodon-tl--set-buffer-spec (buffer-name buf) "instance" nil) + (goto-char (point-min)))))) (defun mastodon-views--format-key (el pad) "Format a key of element EL, a cons, with PAD padding." @@ -902,8 +898,8 @@ IND is the optional indentation level to print at." (indent-to 4) (insert (format "%-5s: " - (propertize key) - 'face '(:underline t)) + (propertize key + 'face '(:underline t))) (mastodon-views--newline-if-long value) (format "%s" (mastodon-tl--render-text value)) |