aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-auth.el
diff options
context:
space:
mode:
authormartianh <martianh@noreply.codeberg.org>2024-02-08 08:04:48 +0000
committermartianh <martianh@noreply.codeberg.org>2024-02-08 08:04:48 +0000
commit51132d08682b7b13473d24a4bf60417541905c81 (patch)
tree201cc33faec6c856418fc5565d3b81892ad4d394 /lisp/mastodon-auth.el
parenta01eec0d57ed64f8a83784cd48e44fc2961e0d64 (diff)
parent2e6bcd41a9bb5953b20758ada8cec2b4ff8e9b4f (diff)
Merge pull request 'Use display-buffer to allow customization' (#522) from rahguzar/mastodon.el:display-buffer into develop
Reviewed-on: https://codeberg.org/martianh/mastodon.el/pulls/522
Diffstat (limited to 'lisp/mastodon-auth.el')
-rw-r--r--lisp/mastodon-auth.el31
1 files changed, 13 insertions, 18 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."