In the article The Modernization of Emacs, i suggested that emacs's “*scratch*” buffer be removed. In this article, i give some detail about it.
Scratch Buffer Not Useful to Most People
Here are reasons that the scratch buffer is not useful to most people:
It is not useful for 99% of emacs users. If they wanted a scratch pad, they can open a new document and not save it. This way is familiar to all software users.
The “*scratch*” “buffer” is primarily designed for emacs lisp programers. (it defaults to “lisp-interaction-mode”.) Majority of people who use emacs are not lisp coders. For lisp coders, they can easily customize their emacs to have a “*scratch*” “buffer”.
The “*scratch*” “buffer” is a intrusive idiosyncrasy. It is persistent, cannot be closed (it regenerates). It is foreign to all programers. This idiosyncrasy is the first thing presented to users, and it persists.
Scratch Buffer Problems
Here are reasons that a alternative to “*scratch*” “buffer” is more useful:
There is no easy, intuitive way to create multiple scratch buffers. (it is done by using the switch-to-buffer command (C-x b) and give a name that is not one of existing buffers.)
When the scratch buffer is closed, emacs does not prompt user to save it. This easily causes data loss.
A scratch pad can be very useful not just for temporary elisp code but for any scratch notes or programing in other languages. (For example, well known programer Stevey Yegg in his popular
Effective Emacs blog, considers creating new temp buffer as a top 10 tip in emacs productivity.) Emacs's “*scratch*” buffer is narrowly geared for elisp editing only, defaulting to “lisp-interaction-mode”.
Emacs does not provide a user level function to create a new buffer. It has menu 〖File▸Open file…〗 (a wrapper to the find-file command), which immediately prompt user for a full file path. This is annoying. Modern apps's New File command actually just create a new untitled file without prompting, and prompt only when user wants to save it. If user closes it, it prompts for saving.
Proposed Fix: Adding a “new-buffer” Command
I propose that emacs should add a menu command “new-buffer”. Once called, it should create a empty buffer titled “untitled”. If one already exists, append numbers such “untitled 2”. Here are the reasons:
The menu command “New” is a widely adopted standard among apps across Mac, Windows, Linux. It is familiar to all software users.
A “new-buffer” command can completely cover the functionality of emacs's “*scratch*” buffer.
When users want to have a scratch buffer, he can just call “new-buffer”, or use the menu, or use a hotkey provided by emacs.
The name “untitled” is conventional, widely understood, than “scratch”.
For those who use scratch buffer for elisp coding, she can set a preference so that the new buffer default to “lisp-interaction-mode” as with scratch buffer. (for example, thru emacs's command “customize”.)
Adopting the suggestion would fix several problems for those who actually use emacs's “*scratch*” buffer. ① emacs no longer mysteriously spawn a “*scratch*” when emacs starts, or respawn the “*scratch*” buffer when user tries to close all buffers. ② Multiple scratch buffers can be created by a keyboard shortcut. ③ Data lose is prevented because closing a scratch buffer will prompt for save.