diff options
Diffstat (limited to 'pearl.el')
| -rw-r--r-- | pearl.el | 32 |
1 files changed, 30 insertions, 2 deletions
@@ -146,6 +146,34 @@ With the default nil, `pearl-surface-buffer' shows the buffer via :type 'boolean :group 'pearl) +(defcustom pearl-compose-window-side 'bottom + "Side of the frame Pearl's compose and conflict buffers open from. +One of `bottom', `top', `left', or `right'. Pearl always applies this side +window when popping a compose buffer, overriding any `display-buffer-alist' +entry for those buffers." + :type '(choice (const bottom) (const top) (const left) (const right)) + :group 'pearl) + +(defcustom pearl-compose-window-size 0.3 + "Size of Pearl's compose and conflict side window. +A float below 1 is a fraction of the frame (0.3 = 30%); an integer is an +absolute size in lines (for `bottom'/`top') or columns (for `left'/`right'). +Paired with `pearl-compose-window-side'." + :type 'number + :group 'pearl) + +(defun pearl--compose-display-action () + "Return the `display-buffer' action for a compose or conflict buffer. +A side window on `pearl-compose-window-side', sized by +`pearl-compose-window-size' -- `window-width' for the left/right sides, +`window-height' for top/bottom." + (cons '(display-buffer-in-side-window) + (list (cons 'side pearl-compose-window-side) + (cons (if (memq pearl-compose-window-side '(left right)) + 'window-width + 'window-height) + pearl-compose-window-size)))) + (defun pearl--surface-buffer (buffer) "Bring BUFFER to a window after a command updated it, unless already shown. No-op when `pearl-surface-buffer' is nil, BUFFER is dead, or BUFFER is already @@ -2136,7 +2164,7 @@ sibling of `pearl--resolve-conflict-in-smerge'." (local-set-key (kbd "C-c C-c") #'pearl--compose-submit) (local-set-key (kbd "C-c C-k") #'pearl--compose-abort) (goto-char (point-max))) - (pop-to-buffer buf) + (pop-to-buffer buf (pearl--compose-display-action)) buf)) (defvar-local pearl--conflict-on-finish nil @@ -2171,7 +2199,7 @@ given, is a thunk run on abort so the save engine can report the outcome." (setq-local header-line-format (substitute-command-keys "Resolve the conflict, then \\[pearl--conflict-commit] to push, \\[pearl--conflict-abort] to abort"))) - (pop-to-buffer buf))) + (pop-to-buffer buf (pearl--compose-display-action)))) (defun pearl--conflict-commit () "Finish the current pearl conflict buffer, pushing the reconciled text. |
