I want to change the major mode from fundamental-mode
to compilation-mode
for a buffer which contains some generated output named for eg. *results*
. I've tried to add an entry to auto-mode-alist
but if i understand correctly this works only with buffers which have a corresponding filename.
I've tried to add it in the list like this but this is not working.
(add-to-list 'auto-mode-alist '("\\*result\\*" . compilation-mode))
UPDATE:
After some digging in I found that this particular lisp snippet is filling the buffer with data.
(start-process "result" "*result*" "some_unix_command")
UPDATE:
This buffer is generated from a 3rd party plugin so i'd rather not start and change the src lisp code. I'd like to handle this on a different level.
I've already checked if I can attach a hook somewhere where the buffer is created and the answer is negative.
Anyone with some ideas on how I can do this?
The auto-mode-alist variable is an AssociationList that associates MajorModes with a pattern to match a buffer filename when it is first opened
cmake-ide
and the buffer which captures some output is*cmake*
cmake-ide
. Also please tell us which command (or Elisp chunk in your .emacs) you're using that ends up creating this buffer.