Skip to content

Commit

Permalink
transient-prefix: Add display-action slot
Browse files Browse the repository at this point in the history
This change lets each transient-prefix display according to its own
display-buffer-action.  Resolves this discussion:

#303
  • Loading branch information
josephmturner committed Nov 30, 2024
1 parent d64b73e commit 9493562
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lisp/transient.el
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ If `transient-save-history' is nil, then do nothing."
(transient-suffix :initarg :transient-suffix :initform nil)
(transient-non-suffix :initarg :transient-non-suffix :initform nil)
(transient-switch-frame :initarg :transient-switch-frame)
(display-action :initarg :display-action :initform nil)
(refresh-suffixes :initarg :refresh-suffixes :initform nil)
(environment :initarg :environment :initform nil)
(incompatible :initarg :incompatible :initform nil)
Expand Down Expand Up @@ -3856,12 +3857,9 @@ have a history of their own.")
(when-let ((line (transient--separator-line)))
(insert line)))
(unless (window-live-p transient--window)
(when (eq (car transient-display-buffer-action)
'display-buffer-full-frame)
(user-error "Invalid value for `transient-display-buffer-action'"))
(setq transient--window
(display-buffer transient--buffer
transient-display-buffer-action)))
(transient--display-action))))
(when (window-live-p transient--window)
(with-selected-window transient--window
(set-window-parameter nil 'prev--no-other-window
Expand All @@ -3872,6 +3870,13 @@ have a history of their own.")
(transient--goto-button focus))
(transient--fit-window-to-buffer transient--window)))))

(defun transient--display-action ()
(let ((action (or (oref transient--prefix display-action)
transient-display-buffer-action)))
(when (eq (car action) 'display-buffer-full-frame)
(user-error "Invalid value for `transient-display-buffer-action'"))
action))

(defun transient--fit-window-to-buffer (window)
(let ((window-resize-pixelwise t)
(window-size-fixed nil))
Expand Down

0 comments on commit 9493562

Please sign in to comment.