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. (e.g. 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, etc}.
- 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
2012-01-12 Thanks to Tom Davey for a correction.
Emacs Modernization
- Emacs Modernization: Simple Changes Emacs Should Adopt
- Why Emacs Keys are Painful
- Emacs: Problems of the Scratch Buffer
- Emacs Modernization: Meta Key Notation
- Emacs Menu Usability Problem
- Emacs Mode Line Problem
- Emacs cua-mode Problems
- Emacs: Inconsistency of Search Features
- Problems of grep in Emacs
- Emacs: Usability Problems of Mode Documentation
- Problems of Emacs Manual
- Emacs Manual Sucks by Examples
- Emacs: kill-buffer Induces Buffer Accumulation
- Emacs Spell Checker Problems
- Emacs: Form Feed ^L Problem
- Emacs: Single Key to Delete Whole Line
- Emacs HTML Mode Sucks
- Emacs Does Not Support Viewing Images Files In Windows
- Emacs Should Adopt HTML as Texinfo Replacement
- Emacs Should Support HTML Mail
- Problems of Emacs's “man” Command
- Emacs Lisp Mode Syntax Coloring Problem
- Emacs AutoHotkey Mode Problems
- Elisp: Ban Syntax Table
- Emacs: Make elisp-index-search use Current Symbol
- Emacs GNU Texinfo Problems; Invalid HTML
- A Record of Frustration in IT Industry; 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)
- Thoughts on Common Lisp Scheme Lisp Based Emacs
- Text Editors Popularity and Market Research
- Text Editor's Cursor Movement Behavior (emacs, vi, Notepad++)
- Emacs: Usability Problems of Letter-Case Changing Commands
- Emacs Select Word Command Problem
- Emacs: Search Current Word 🚀
- Emacs fill-paragraph Problem