Pregunta

I Recientemente añadido la línea

(set-default-font "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1")

a mi archivo .emacs. Después de eso find-file-other-window siempre se abre una nueva ventana en lugar de utilizar las ventanas existentes. ¿Por qué eso sucederá !? ¿Cómo puedo solucionarlo?

No entiendo cómo funciona todo este tipo de letra mágicos-config, por lo que si en realidad es obvio que lo siento.

Editar: Tengo una bastante grande resolución, y mi tamaño de la fuente ha disminuido muy significativamente. No find-file-other-window tiene en cuenta el espacio disponible personaje? Tal vez sea la decisión que hay tan mucho ambiente que puede permitirse el lujo de ventanas abiertas simplemente queramos o no.

¿Fue útil?

Solución

find-file-other-window ultimately calls display-buffer, which runs a complex algorithm to decide whether to reuse an existing window or make one and how. In particular, if display-buffer decides it needs to create or recycle a window, it tries calling split-window-preferred-function to split the biggest window. By default, split-window-preferred-function is split-window-sensibly, which is willing to split windows vertically if they are more than split-height-threshold lines high, or failing that horizontally if they are more than split-width-threshold columns wide.

It looks like you want

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

N.B. This answer applies to GNU Emacs 23. Earlier versions didn't have horizontal splitting. Later versions may do things differently.


A few ways to find this out (none straightforward):

  • If you guess that what's going on is called splitting a window: M-x apropos RET split RET shows a number of variables and functions, and you might figure out which ones are relevant. Or if you guess that there's an option (there often is), C-h v split- TAB shows promising leads.
  • The documentation for find-file-other-window references Displaying Buffers. (You have to go to the Elisp manual for this level of detail; within Emacs, C-h i m elisp RET brings up the Elisp manual, and i find-file-other-window RET leads you to the documentation for this function.) It's less clear that pop-to-buffer is the passage to read there; it references Choosing Window which contains the sought after information.
  • C-h f find-file-other-window RET shows the built-in documentation for the function. It links to display-buffer. The description of display-buffer doesn't describe its operation in detail, so from there you need to either consult the Elisp manual as above or explore the source of display-buffer by clicking on window.el.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top