Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using emacs for my daily javascript editing, to switch between buffers I use C-x LEFT and C-x RIGHT and I'm fine with this (even if I find it difficult to know the path of the file I'm modifying).

My problems:

  1. at the startup I always have *scratch* and *Messages* opened, I thought that putting (kill-buffer "*scratch*") in my .emacs would solve the issue, but it's not, do you have a suggestion?

  2. when I open files I always do TAB autocomplete, so each time I'm creating a new *Messages* buffer containing the options for the completion, how do I prevent this from creating, or better, how do I make emacs kill it, after I've made my choice?

Do say your opinion if you think I'm doing something that's not "the way it should be" with me navigating as I said at the top.

share|improve this question
1  
You may want to explore other ways of switching buffers as Trey suggested. If you opt for an other method which is not sequential then you can jump to the wanted buffer right away, so it does not matter if unwanted buffers are in the buffer list. I use iswitchb myself. –  Tom Sep 1 '11 at 4:40
    
Thanks for the suggestion, I'll have a look at it. –  Alberto Zaccagni Sep 1 '11 at 12:38

2 Answers 2

up vote 3 down vote accepted

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)
share|improve this answer
1  
Thank you so much for this, I wish I could give you more rep. –  Alberto Zaccagni Sep 2 at 20:30
    
You're most welcome! :D –  oles Sep 4 at 9:17

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.

share|improve this answer
    
I'm saving my sessions with (desktop-save-mode 1), so almost always I'll have something open at startup, I'll look at those packages, thanks. –  Alberto Zaccagni Sep 1 '11 at 12:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.