Prevent unwanted buffers from opening
This drove me mad.. until I fixed it.
Now there's no scratch, messages, or completions buffers to screw with your flow. Enjoy!
Place this in your .emacs:
;; Makes *scratch* empty.
(setq initial-scratch-message "")
;; Removes *scratch* from buffer after the mode has been set.
(defun remove-scratch-buffer ()
(if (get-buffer "*scratch*")
(kill-buffer "*scratch*")))
(add-hook 'after-change-major-mode-hook 'remove-scratch-buffer)
;; Removes *messages* from the buffer.
(setq-default message-log-max nil)
(kill-buffer "*Messages*")
;; Removes *Completions* from buffer after you've opened a file.
(add-hook 'minibuffer-exit-hook
'(lambda ()
(let ((buffer "*Completions*"))
(and (get-buffer buffer)
(kill-buffer buffer)))))
;; Don't show *Buffer list* when opening multiple files at the same time.
(setq inhibit-startup-buffer-menu t)
;; Show only one active window when opening multiple files at the same time.
(add-hook 'window-setup-hook 'delete-other-windows)
Bonus:
;; No more typing the whole yes or no. Just y or n will do.
(fset 'yes-or-no-p 'y-or-n-p)
Well... it's partially the way Emacs works, but there are things you can do to help switching in general.
First, Emacs has to have at least one buffer. So, even if you wanted to get rid of *scratch*
and *Messages*
, you'd be left with yet another buffer you didn't want (or you'd get the point where Emacs just ignored your last kill-buffer
request because it was re-creating that buffer (b/c it needs one buffer).
So, the best way to get to the point where switching buffers makes more sense is to actually have buffers you want to switch to.
And, when you've done that, you can look at all the options/packages available to you for switching buffers - many of which are listed on the Emacs Wiki under SwitchingBuffers. ido
is pretty popular, as are icicles
and anything
.