Hello,
I started using slime not too long ago. Soon I found myself using the slime selector methods a lot, switching to the REPL and back again to the source file. But soon I realized that I wanted both buffers visible most of the time. Instead of `switch-to-buffer', I liked slime to use `pop-to-buffer' in its selector methods.
Attached is a diff against the current CVS HEAD that introduces a new customization variable into slime, `slime-select-buffer-function', which will allow the user to either switch the buffer selection behavior from `switch-to-buffer' to `pop-to-buffer' semantics, or to provide her own function.
Other changes: When using another function than `switch-to-buffer' as a buffer selection function, the algorithm selecting recent source buffers will also consider visible buffers if they are not the current one. This will toggle between the last two buffers instead of rotating the buffers.
When uncustomized the patch should retain the current behavior.
Ole
I forgot a changelog entry for my patch, here it is:
2007-05-11 Ole Arndt <ole <at> sugarshark.com>
* slime.el (slime-select-buffer-function): New customization variable. (def-slime-selector-method): Use slime-select-buffer-function. (slime-recently-visited-buffer): Optionally find visible buffers as well. (def-slime-selector-method ?l): Find visible buffers if slime-select-buffer-function unequal 'switch-to-buffer (def-slime-selector-method ?e): dito
Schönen Gruß, Ole
Ole Arndt ole@sugarshark.com writes:
Attached is a diff against the current CVS HEAD that introduces a new customization variable into slime, `slime-select-buffer-function', which will allow the user to either switch the buffer selection behavior from `switch-to-buffer' to `pop-to-buffer' semantics, or to provide her own function.
Hi Ole,
the patch as such looks very good, but I could envision that both behaviours are actually useful depending on the situation. Thus I wonder if it wasn't more prudent to make it pop when a prefix was given by the user. (`C-u') What do you think?
-T.
P.S.: Btw. I noticed that the help buffer isn't properly closed when you first press `?', and then one of the other choices. If you've got time, a patch would be greatly welcomed as well. :)
Hello Tobias,
"Tobias C. Rittweiler" tcr@freebits.de writes:
the patch as such looks very good, but I could envision that both behaviours are actually useful depending on the situation. Thus I wonder if it wasn't more prudent to make it pop when a prefix was given by the user. (`C-u') What do you think?
actually that was my first idea as well. Just the other way around, I wanted it to pop by default and switch with prefix.
I just like the pop-to-buffer behavior better. I think it is easy to type 'C-x 1', in the rare cases when the other window is taking to much screen space. Easier than typing `C-x 2' `C-c r l' `C-x o' if you want to view your last source buffer with your full-frame REPL. ( `C-c r' is my binding for slime-selector.)
Two reasons why I dropped this idea:
- I wanted to support a third, user provideable function. This gives the user for example the possibility to differenciate the switching behavior based on buffer name. The semantics of a prefix for this function are undefined.
- I could not find an easy way of passing the prefix into the selection methods and into all recursive calls of slime-selector.
P.S.: Btw. I noticed that the help buffer isn't properly closed when you first press `?', and then one of the other choices. If you've got time, a patch would be greatly welcomed as well. :)
Attached.
2007-05-18 Ole Arndt <ole <at> sugarshark.com>
* slime.el (def-slime-selector-method ??): Close help buffer if still open after final selection.
Ole