Emacs: Problems of the Scratch Buffer
emacs *scratch* amounts to a bitch but we cannot ditch the banner of our church
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 people 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 designed for emacs lisp programers. (it defaults to
lisp-interaction-mode
.) 99% of emacs users are not lisp coders. - The “*scratch*” “buffer” is a INTRUSIVE idiosyncrasy. It is the first thing presented to users, and it persists.
Scratch Buffer is Inconvenient
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 Alt+x
switch-to-buffer
【Ctrl+x b】 then 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 blog article Effective Emacs, considers creating new temp buffer as a top 10 tip in emacs productivity.)
- 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 command “new-buffer” with menu [File ▸ New]. Once called, it should create a empty buffer titled {untitled, untitled2, untitled3, …}.
- Users can now create multiple temp buffers easily, by just calling “new-buffer”. No more work-around using “switch-to-buffer” method.
- Data lose is prevented because closing any unsaved buffer will prompt for save.
- For lisp coders, new buffer can default to a lisp mode. Other programers can default it to python mode, ruby mode, etc.
- No more redundant and mysterious “*scratch*” concept to new users.
- The menu command “New” is a widely adopted standard among apps across Mac, Windows, Linux.
- A “new-buffer” command completely cover the functionality of emacs's “*scratch*” buffer.
- The name “untitled” is conventional, widely understood.
Implementation
See code at Emacs: New Empty Buffer.
It is implemented in Emacs: Xah Fly Keys and ErgoEmacs Keybinding.
Discussion
The original thread of this discussion, which turned into a flame feast, is here:
Newsgroups: gnu.emacs.help From: Xah Lee. Date: Tue, 16 Sep 2008 13:57:59 -0700 (PDT) Subject: Re: How to get rid of *GNU Emacs* buffer on start-up?
http://groups.google.com/group/gnu.emacs.help/msg/9b1ce96b9e39e47d
Thanks to Tom Davey for a correction.
Emacs Modernization
- Simple Changes Emacs Should Adopt
- Why Emacs Keys are Painful
- Ban Scratch Buffer
- M-x vs Alt+x Notation
- Menu Idiocy
- Mode Line Problem
- cua-mode Problem
- Inconsistency of Search
- grep in emacs Pain
- Problems of describe-mode
- Problems of Emacs Manual
- Emacs Manual Sucks by Examples
- kill-buffer Problem
- Emacs Spell Checker Pain
- Form Feed ^L
- Single Key Delete Whole Line
- Emacs HTML Mode Sucks
- Emacs No View Image on Windows
- HTML should replace Texinfo
- Support HTML Mail
- Problems of “man”
- Emacs Lisp Mode Syntax Coloring Problem
- Emacs AHK Mode Problems
- Ban Syntax Table
- Make elisp-index-search use Current Symbol
- Texinfo Invalid HTML
- Disappearing FSF URLs, 2006
- Emacs Manual Node Persistency Issues
- Emacs: dired-do-query-replace-regex Replace ALL (fixed)
- Problems of Emacs Supporting Obsolete Systems
- Elisp: Function to Copy/Delete a Dir Recursively (fixed)
- CommonLisp/SchemeLisp Emacs
- Text Editors Popularity
- Cursor Movement Behavior Survey
- Letter-Case Commands Problem
- Select Line/Block/Quote, Extend
- isearch Current Word
- Reformat Line Wrap