[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get rid of *GNU Emacs* buffer on start-up?

From: Xah Lee
Subject: Re: How to get rid of *GNU Emacs* buffer on start-up?
Date: Wed, 24 Sep 2008 02:26:30 -0700 (PDT)
User-agent: G2/1.0

On Sep 24, 12:35 am, Kevin Rodgers <address@hidden> wrote:
> Kevin Rodgers wrote:
> >XahLeewrote:
> >> In summary: the problem with find-file is that it promps user to enter
> >> a file name upfront. The problem with switch-to-buffer is that it
> >> doesn't promp to save when user closes it. In both, the functions are
> >> simply not designed for creating a new temp buffer.
> > Wow, if you had put 1% of the effort into coding that you put into this
> > thread, you could have come up with something like this:
> > (defun switch-to-new-buffer ()
> >   "Switch to a new *scratch* buffer."
> >   (interactive)
> >   (switch-to-buffer (generate-new-buffer "*scratch*"))
> >   (setq switch-to-new-buffer t))
>            ^^^^^^^^^^^^^^^^^^^^
> Nikolaj Schumacher's recent message prompted me to check that little
> hack, and I see that it's got a typo.  It should be:
> (defun switch-to-new-buffer ()
>    "Switch to a new *scratch* buffer."
>    (interactive)
>    (switch-to-buffer (generate-new-buffer "*scratch*"))
>    (setq buffer-offer-save t))
> You might like (auto-save-mode 1) in there as well.

A new buffer is not a existing buffer, so the switch in the name is
unfit. Also, since the function's purpose is creating a new *scratch*,
you should have that in the name to reflect the fact.

So, given your code, one step of improvement is to change the name to
new-scratch-buffer or create-scratch-buffer.

But, as i detailed, since scratch is simply a new buffer, and since
now you can create multiple scratches, it ceases to be one special
buffer emacs called *scratch*. So, this comes back to my original
suggestion, that it might simply be better to just have create-new-
buffer. And, if you agree this far, then since you now have a
mechanism to create new buffers proper, and the few emacs developers
agree that *scratch* has problems albeit minor one, we might simply at
this point get rid of the *scratch* because create-new-buffer
completely covers its functionality.

This is exactly what is proposed in my article, alone with code.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]