0

When I use emacs in a separate Window (under X), if I start slime the window is split horizontally if the window's width is smaller than its height, and vertically otherwise. Is it possible to force the direction of the splitting and make it independent of the dimensions of the emacs window? For example, I would like to have slime always open under my source code buffer. I cannot find anything about this in the documentation.

  • See the variables split-height-threshold and split-width-threshold. If you need further assistance, please provide a link to the source code of the function you are calling that results in the undesired behavior and/or the exact name of the function. – lawlist Dec 6 '16 at 2:26
1

According to the doc-string of the variable split-window-preferred-function, the value should be a "[f]unction called by 'display-buffer' routines to split a window." The default value is split-window-sensibly, which has a semi-lengthy doc-string that talks about (in part) the variables split-height-threshold and split-width-threshold; and, those variables in turn have doc-strings. In a nutshell, (setq split-width-threshold nil) will result in split-window-sensibly never splitting a window horizontally. For more information, on these functions or variables, type C-h f or C-h v to describe functions/variables -- or M-x describe-function and M-x describe-variable.

1

Just for reference as lawlist's answer did not work for me. I instead had to use:

  (setq split-height-threshold nil)
  (setq split-width-threshold 0)
0

The splitting behavior can be controlled by setting the variable display-buffer-alist.

Please refer https://www.gnu.org/software/emacs/manual/html_node/elisp/Display-Action-Functions.html

In particular, note display-buffer-below-selected.

An easier to achieve the same is using the package shackle (my personal choice)

For example, the below code aligns all helm buffers to the bottom of the screen, covering 40% of the screen

(setq shackle-rules '(("\\`\\*helm.*?\\*\\'" :align 'below :size 0.4)))

You could do the same for buffers with a given mode, try something like

(setq shackle-rules '((slime-mode :align 'below)))
  • The splitting behavior "can" be controlled by the display-buffer-alist, which is set to nil by default. – lawlist Dec 6 '16 at 17:00
  • Agreed, my mistake. Will edit the answer to reflect that. – Yash Yadavalli Dec 6 '16 at 17:32
  • Thanks for the hints. (setq shackle-rules '((slime-mode :align 'below))) does not change the behaviour in my emacs (version 24.3.1 on Debian GNU/Linux). On the other hand, (setq split-width-threshold 9999) (see lawlist's comment) seems to work just fine. – Giorgio Dec 6 '16 at 19:02
  • @Giorgio -- Even with an utra-high resolution screen or fine print, it is unlikely that a window will ever have 9999 columns. The doc-string for split-width-threshold indicates that a value of nil should have the desired effect: "Documentation: Minimum width for splitting windows sensibly. If this is an integer, ‘split-window-sensibly’ may split a window horizontally only if it has at least this many columns. If this is nil, ‘split-window-sensibly’ is not allowed to split a window horizontally." – lawlist Dec 7 '16 at 1:45
  • @lawlist: Indeed, (setq split-width-threshold nil) works as well. If you write this hint up as an answer I will accept it. – Giorgio Dec 7 '16 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.