Skip to content

Commit

Permalink
transient-prefix: Add display-buffer-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 27, 2024
1 parent d64b73e commit 3e3a76c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lisp/transient.el
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,8 @@ If `transient-save-history' is nil, then do nothing."
(suffix-description :initarg :suffix-description)
(variable-pitch :initarg :variable-pitch :initform nil)
(column-widths :initarg :column-widths :initform nil)
(unwind-suffix :documentation "Internal use." :initform nil))
(unwind-suffix :documentation "Internal use." :initform nil)
(display-buffer-action :initarg :display-buffer-action :initform nil))
"Transient prefix command.
Each transient prefix command consists of a command, which is
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-buffer-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-buffer-action ()
(let ((action (or (oref transient--prefix display-buffer-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 3e3a76c

Please sign in to comment.