How to create a buffer similar to * compilation * in Emacs?

I have an asynchronous process in Emacs that creates a TAGS file.

This process creates a process buffer called * ctags *. If the result of the process is "finished \ n", I kill the buffer.

If the result of the process is something else, I want to display a process buffer similar to the * compilation * status output when Mx compilation starts.

those. I want to vertically split the screen and show the * ctags * buffer at the bottom. Pressing q will preferably kill the bottom buffer and just show my source buffer.

I tried using this in my method callback:

(split-window-vertically)
(set-window-buffer (selected-window) (get-buffer "* ctags *"))

but besides the fact that it places the * ctags * buffer on top, the buffer does not have the same characteristics as the output * of compilation *, for example. pressing q inserts q.

How to create a buffer, for example * compilation *?

EDIT:

Inspired by Trey Jackson below, this does exactly what I want:

(pop-to-buffer (get-buffer "* ctags *"))
(compilation-mode)

He selects the buffer * ctags *, puts it in compilation mode and q will exit the window.

EDIT2: Use

(compilation-mode)
(main mode instead of minor mode) because Emacs somehow does not like re-applying minor mode to an existing buffer.

The error message I get is:

Toggling compilation-minor-mode off; better pass explicit argument.
+3
source share
2

*compilation*, script:

(compilation-mode)
+5

..

+2

Source: https://habr.com/ru/post/1714715/


All Articles