Subject: bug#11298: 24.0.95; (WISH) Re-look scratch buffers

From: Jambunathan K <[email-masked]>
Date: Sun, 22 Apr 2012 02:20:01 +0530

Stefan Monnier <[email-masked]> writes:

>> 1. Allow multiple scratch buffers one for each mode the user is
>>    interested in.
>
> We do not disallow that, so could you be more specific in what you mean
> by that?
>

Instead of creating one scratch buffer, make changes such a way that N
scratch buffers are created. N = 0, 1, 2, 3 etc etc.

>>    The defcustom can have a solitary text-mode entry.
>
> Which defcustom?

This defcustom will be newly introduced as part of this change.  Let's
call it `scratch-buffer-modes'.  With the below setting,

  (setq scratch-buffer-modes '(emacs-lisp-mode org-mode))

I will get 2 scratch buffers by default on startup.  One *org-scratch*
in org-mode and one *emacs-lisp-scratch* in emacs-lisp mode.

If someone is unhappy with having any scratch buffers at all, then one
could just do a

  (setq scratch-buffer-mode nil)

>>       C-u C-x b can offer to create *scratch-%s* (or %s-scratch) in
>>       %s-mode.
>
> Interesting idea.  It might not even need a C-u: we could simply make
> C-x b query the user for a major-mode when the buffer doesn't exist yet
> (and we could try and take a hint from the buffer name to guess a good
> default: e.g. looking for a major-mode name in the buffer name, or
> matching the buffer name against auto-mode-alist).

Whatever is chosen, this prompt "No buffer matching whatever, create one
(y/n)?" should be removed.  This is annoying.  I am not destroying
things.  I am not sure why the world is against people creating stuff
:-).

A sensible name *must* be offered, which I can just RET with possibly a
minor modification.

>> 3. I think it is not the scratch buffer that is idiosyncratic but the
>>    /name/.  Instead of using scratch one could call it say a notes
>>    buffer or a temp buffer.
>
> I'm not married to "*scratch*", but "notes" sounds like something you'd
> want to save, and "temp" sounds like something that might disappear
> without warning.

May be, marry scratch buffer with emacs-lock-mode...

I don't use persistent scratch buffers. 

A persistent scratch buffer could be same as what we now call an
`initial-buffer-choice'.  Only difference is that the file is
~/.emacs.d/scratch ("secretly" chosen by the Emacs).