Emacs: Problems of the Scratch Buffer

By Xah Lee. Date: . Last updated: .
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:

  1. 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.
  2. The “*scratch*” “buffer” is designed for emacs lisp programers. (it defaults to lisp-interaction-mode.) 99% of emacs users are not lisp coders.
  3. 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:

  1. There is no easy, intuitive way to create multiple scratch buffers. (it is done by Alt+x switch-to-bufferCtrl+x b】 then give a name that is not one of existing buffers.)
  2. When the scratch buffer is closed, emacs does not prompt user to save it. This easily causes data loss.
  3. 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.)
  4. 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, …}.

  1. Users can now create multiple temp buffers easily, by just calling “new-buffer”. No more work-around using “switch-to-buffer” method.
  2. Data lose is prevented because closing any unsaved buffer will prompt for save.
  3. For lisp coders, new buffer can default to a lisp mode. Other programers can default it to python mode, ruby mode, etc.
  1. No more redundant and mysterious “*scratch*” concept to new users.
  2. The menu command “New” is a widely adopted standard among apps across Mac, Windows, Linux.
  3. A “new-buffer” command completely cover the functionality of emacs's “*scratch*” buffer.
  4. The name “untitled” is conventional, widely understood.

Implementation

See code at Emacs: New Empty Buffer.

It is implemented in ErgoEmacs Keybinding. Press 【Ctrl+n】 to create a new buffer.

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

  1. Simple Changes Emacs Should Adopt
  2. Why Emacs Keys are Painful
  3. Problems of the Scratch Buffer
  4. M-key Notation vs Alt+key Notation
  5. Menu Problem
  6. Mode Line Problem
  7. cua-mode Problems
  8. kill-buffer Induces Buffer Accumulation
  9. Emacs Form Feed ^L
  10. Inconsistency of Search Features
  11. Single Key to Delete Whole Line
  12. Emacs HTML Mode Sucks
  13. Emacs Does Not Support Viewing Images Files In Windows
  14. Emacs Spell Checker Problems
  15. Adopt HTML as Texinfo Replacement
  16. Support HTML Mail
  17. Problems of “man” Command
  18. Emacs Lisp Mode Syntax Coloring Problem
  19. Emacs Ahk Mode Problems
  20. Problems of Emacs's Manual
  21. Problems of Emacs's Manual; Examples
  22. Emacs: Have You Read Emacs Manual?
  23. Elisp: Ban Syntax Table
  24. Emacs: Make elisp-index-search use Current Symbol
  25. Emacs: Usability Problems of Mode Documentation
  26. Emacs GNU Texinfo Problems; Invalid HTML
  27. A Record of Frustration in IT Industry; Disappearing FSF URLs, 2006
  28. Emacs Manual Node Persistency Issues
  29. Emacs: dired-do-query-replace-regex Replace ALL (fixed)
  30. Problems of Emacs Supporting Obsolete Systems
  31. Elisp: Function to Copy/Delete a Dir Recursively (fixed)
  32. Thoughts on Common Lisp Scheme Lisp Based Emacs
  33. Text Editors Popularity and Market Research
  34. Text Editor's Cursor Movement Behavior (emacs, vi, Notepad++)
  35. GNU Emacs Development Inefficiency
  36. Emacs Dev Inefficiency and Emacs Web 2.0?
  37. Letter-Case Commands Usability Problems
  38. Emacs: Select Line, between Quotes, Extend Selection
  39. Emacs: isearch Current Word
  40. Suggestions on Line Wrap Commands
  41. Emacs: Single Key to Delete Whole Line
  42. Emacs Undo and Emacs Cult Problem

If you have a question, put $5 at patreon and message me.
Or Buy Xah Emacs Tutorial
Or buy a nice keyboard: Best Keyboards for Emacs

Emacs

Emacs Lisp

Misc