Emacs tip

Got tired of accidentally killing my scratch buffer.. this moves it to the back of the buffer list if you try to kill it.

 

(defadvice kill-buffer (around kill-buffer-around-advice activate)
    (let ((buffer-to-kill (ad-get-arg 0)))
        (if (equal buffer-to-kill "*scratch*")
            (bury-buffer)
          ad-do-it)))

2 thoughts on “Emacs tip”

Leave a Reply