Some buffers are created by Emacs and is set in fundamental mode, like the *Org-Babel results*
. I think it is more convenient to set them in special mode, which can be closed with key q
. How do set the mode for those automatic buffers or if the name contains *
?
Lawlist and Drew's comments below show possible ways to do it, what I want is a special-display buffers for some buffers with *...*
names. The appropriate way of course is to find the function for creating the buffer and change it in the package, but it doesn't suit everybody.
Since special-display-regexps
is obsolete, can anyone help me on an display-buffer-alist
with a custom function to look for *Org-Babel Results*
and set it to special mode?
get-buffer-create
,display-buffer
,pop-to-buffer
, etc.(pop-to-buffer (get-buffer-create "*Org-Babel Results*"))
or after the next line -- i.e.,(delete-region (point-min) (point-max))
-- you could add a line(with-current-buffer (get-buffer "*Org-Babel Results*") (enable-my-custom-major-mode))
In my opinion, this is much more precise/localized than customizing thedisplay-buffer-alist
with a custom function to look for*Org-Babel Results*
, which is another possibility, but I don't recommend broad brush approaches like that.