I want to kill some buffers created by default, such as the GNU Emacs, but putting:
(kill-buffer "*GNU Emacs*")
On the .emacs doesn't work. I guess this code is called before the initial buffers are created. There should be some kind of hook, but I want it to be run only at the start up, to clean all the initial buffers I don't need.
Edit:
Tried after-init-hook and emacs-startup-hook without success.
Edit 2:
Put some code on .emacs to see what's happening:
(defun buffer-hook-function ()
(append-to-file (format "%s" (buffer-list)) nil "log.txt")
(append-to-file "\n" nil "log.txt")
)
(append-to-file "Executou .emacs\n" nil "log.txt")
(add-hook 'emacs-startup-hook (lambda () (append-to-file "emacs-startup-hook\n" nil "log.txt")))
(add-hook 'after-init-hook (lambda () (append-to-file "after-init-hook\n" nil "log.txt")))
(add-hook 'before-init-hook (lambda () (append-to-file "before-init-hook\n" nil "log.txt")))
(add-hook 'window-setup-hook (lambda () (append-to-file "window-setup-hook\n" nil "log.txt")))
(add-hook 'emacs-startup-hook (lambda () (append-to-file "window-setup-hook\n" nil "log.txt")))
(add-hook 'buffer-list-update-hook 'buffer-hook-function)
After starting emacs, the output on log.txt is:
Ran .emacs
(*scratch* *Minibuf-0* *Messages* *code-conversion-work* *Echo Area 0* *Echo Area 1*)
after-init-hook
window-setup-hook
emacs-startup-hook
window-setup-hook
(*scratch* *Minibuf-0* *Messages* *code-conversion-work* *Echo Area 0* *Echo Area 1* *temp*)
(*scratch* *Minibuf-0* *Messages* *code-conversion-work* *Echo Area 0* *Echo Area 1*)
(*scratch* *Minibuf-0* *Messages* *code-conversion-work* *Echo Area 0* *Echo Area 1* *GNU Emacs*)
(*scratch* *Minibuf-0* *Messages* *code-conversion-work* *Echo Area 0* *Echo Area 1* *GNU Emacs* *temp*)
(*scratch* *Minibuf-0* *Messages* *code-conversion-work* *Echo Area 0* *Echo Area 1* *GNU Emacs*)
(*scratch* *Minibuf-0* *Messages* *code-conversion-work* *Echo Area 0* *Echo Area 1* *GNU Emacs* *temp*)
(*scratch* *Minibuf-0* *Messages* *code-conversion-work* *Echo Area 0* *Echo Area 1* *GNU Emacs*)
(*scratch* *Minibuf-0* *Messages* *code-conversion-work* *Echo Area 0* *Echo Area 1* *GNU Emacs*)
(*GNU Emacs* *scratch* *Minibuf-0* *Messages* *code-conversion-work* *Echo Area 0* *Echo Area 1*)
I'm not finding a hook for being executed after all those initial buffers are created... Maybe I'll need to do some shenanigan to capture this event.