aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-auth.el31
-rw-r--r--lisp/mastodon-http.el1
-rw-r--r--lisp/mastodon-tl.el4
-rw-r--r--lisp/mastodon.el4
4 files changed, 17 insertions, 23 deletions
diff --git a/lisp/mastodon-auth.el b/lisp/mastodon-auth.el
index 279377b..9f9d128 100644
--- a/lisp/mastodon-auth.el
+++ b/lisp/mastodon-auth.el
@@ -105,30 +105,25 @@ code. Copy this code and paste it in the minibuffer prompt."
(defun mastodon-auth--show-notice (notice buffer-name &optional ask)
"Display NOTICE to user.
-NOTICE is displayed in vertical split occupying 50% of total
+By default NOTICE is displayed in vertical split occupying 50% of total
width. The buffer name of the buffer being displayed in the
window is BUFFER-NAME.
When optional argument ASK is given which should be a string, use
ASK as the minibuffer prompt. Return whatever user types in
response to the prompt.
When ASK is absent return nil."
- (let ((buffer (get-buffer-create buffer-name))
- (inhibit-read-only t)
- ask-value window)
- (set-buffer buffer)
- (erase-buffer)
- (insert notice)
- (fill-region (point-min) (point-max))
- (read-only-mode)
- (setq window (select-window
- (split-window (frame-root-window) nil 'left)
- t))
- (switch-to-buffer buffer t)
- (when ask
- (setq ask-value (read-string ask))
- (kill-buffer buffer)
- (delete-window window))
- ask-value))
+ (if ask
+ (read-string ask)
+ (let ((buffer (get-buffer-create buffer-name))
+ (inhibit-read-only t))
+ (set-buffer buffer)
+ (erase-buffer)
+ (insert notice)
+ (fill-region (point-min) (point-max))
+ (read-only-mode)
+ (prog1 nil
+ (pop-to-buffer buffer '(display-buffer-in-side-window
+ (side . left) (window-width . 0.5)))))))
(defun mastodon-auth--request-authorization-code ()
"Ask authorization code and return it."
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index a357672..541c92e 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -240,7 +240,6 @@ Callback to `mastodon-http--get-response-async', usually
(defun mastodon-http--process-headers ()
"Return an alist of http response headers."
- (switch-to-buffer (current-buffer))
(goto-char (point-min))
(let* ((head-str (buffer-substring-no-properties
(point-min)
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 561087e..d4f3d04 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -287,7 +287,7 @@ It is active where point is placed by `mastodon-tl--goto-next-item.'")
"Evaluate BODY in a new or existing buffer called BUFFER.
MODE-FUN is called to set the major mode.
OTHER-WINDOW means call `switch-to-buffer-other-window' rather
-than `switch-to-buffer'."
+than `pop-to-buffer'."
(declare (debug t)
(indent 3))
`(with-current-buffer (get-buffer-create ,buffer)
@@ -296,7 +296,7 @@ than `switch-to-buffer'."
(funcall ,mode-fun)
(if ,other-window
(switch-to-buffer-other-window ,buffer)
- (switch-to-buffer ,buffer))
+ (pop-to-buffer ,buffer '(display-buffer-same-window)))
,@body)))
(defmacro mastodon-tl--do-if-item (&rest body)
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index bac4d67..c9c3b64 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -289,7 +289,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)
+ (display-buffer buffer)
(mastodon-tl--get-home-timeline)
(message "Loading Mastodon account %s on %s..."
(mastodon-auth--user-acct)
@@ -335,7 +335,7 @@ from the server and load anew."
"*mastodon-notifications*")))
(if (and (not force)
(get-buffer buffer))
- (progn (switch-to-buffer buffer)
+ (progn (display-buffer buffer)
(mastodon-tl--update))
(message "Loading your notifications...")
(mastodon-tl--init-sync (or buffer-name "notifications")