[emacs-berlin] Open a new window splitting the frame horizontally

jman emacs-berlin at city17.xyz
Mon Nov 18 16:12:31 UTC 2024


Hi, I'm trying to modify the `rg.el` package (an interface to ripgrep[0]) when it opens the buffer 
with the search results. I'm vaguely familiar with concepts like "frame", "window" and "buffer" and 
IIUC by default Emacs opens a window horizontally or vertically based on space available (using 
`split-window-sensibly`).

I want to modify this behaviour so that the search results window containing the *rg* buffer always 
splits the frame horizontally.

I've tried asking the rg.el maintainer but I don't understand their suggestion:
https://github.com/dajva/rg.el/issues/181

I've looked at the Emacs documentation[1]. I think I can accomplish this with the following snippet:

(setopt
 display-buffer-alist
 '(("\\*rg\*"
    (display-buffer-below-selected display-buffer-at-bottom)
    )))

somehow it works because the frame is split horizontally but I get this error: "error in process 
sentinel: Symbol’s function definition is void: nil". The toggle-debug-on-error is not very helpful:

Debugger entered--Lisp error: (void-function nil)
  nil(#<buffer *rg*> "finished\n")
  compilation-handle-exit(exit 0 "finished\n")
  compilation-sentinel(#<process rg> "finished\n")

Any comment on my approach? Any suggestion?

Thanks!

[0]: https://github.com/dajva/rg.el
[1]: https://www.gnu.org/software/emacs/manual/html_node/elisp/Displaying-Buffers.html


More information about the emacs-berlin mailing list