sly icon indicating copy to clipboard operation
sly copied to clipboard

sly-mrepl should default DISPLAY-ACTION to pop-to-buffer-same-window when called interactively

Open spwhitton opened this issue 3 years ago • 4 comments

Hello,

sly-mrepl defaults DISPLAY-ACTION to switch-to-buffer when called interactively, but that means you can't use display-buffer-alist to customise the behaviour of C-c C-z, and you can't do things like C-x 4 4 C-c C-z, C-x 5 5 C-c C-z etc. using those new bindings in Emacs 28. So I'd like to propose that it default DISPLAY-ACTION to pop-to-buffer-same-window, to enable those other things to work.

Thanks.

spwhitton avatar Mar 07 '21 00:03 spwhitton

Seems reasonable, but can you explain if it would change the current behavior for those who don't customize it?

joaotavora avatar Mar 07 '21 04:03 joaotavora

Hello,

On Sat 06 Mar 2021 at 08:20PM -08, João Távora wrote:

Seems reasonable, but can you explain if it would change the current behavior for those who don't customize it?

It wouldn't -- if nothing in display-buffer-alist refers to the sly repl, then it will behave exactly the same as switch-to-buffer.

-- Sean Whitton

spwhitton avatar Mar 07 '21 05:03 spwhitton

It wouldn't -- if nothing in display-buffer-alist refers to the sly repl, then it will behave exactly the same as switch-to-buffer.

There are still two details, though:

  1. The default value of display action is not switch-to-buffer, rather a function based on it.
  2. If we substitute switch-to-buffer for pop-to-buffer-same-window it does seem to work backward compatibly, except that I'm not sure it if won't break in Emacs 25. Maybe you could test?

Thanks

joaotavora avatar Mar 07 '21 14:03 joaotavora

I tested replacing the call to switch-to-buffer with one to pop-to-buffer-same-window within interactive form, in Emacs 25, and it works as expected: no change unless display-buffer-alist refers to sly-mrepl buffers. So seems like this change is a safe one to make.

spwhitton avatar Mar 07 '21 21:03 spwhitton