[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 03:02:30 -0700 (PDT)
User-agent: G2/1.0

On Sep 24, 12:54 am, Kevin Rodgers <address@hidden>
> Here's my attempt at critical thinking:
> 1. You said that find-file and switch-to-buffer each have problems, so I
> wrote a new command that has neither problem.  That is called a
> solution.


> 2. You said that neither function is designed for creating a new
> temporary buffer.  That is true of find-file, which can create a new
> buffer, but a buffer whose contents are to be persisted i.e. not
> temporary.  I think switch-to-buffer _is_ designed for creating a new
> temporary buffer, just a buffer that has a user-specified name.

this i don't  agree. Quote from my article:

    * There is no easy, intuitive way to create multiple scratch
buffers. (it is done by using the switch-to-buffer command (C-x b) and
give 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 Effective
Emacs↗ blog list it as a top 10 tip in emacs productivity.) Emacs's
“*scratch*” buffer is narrowly geared for elisp editing only,
defaulting to emacs-lisp-mode.

    * 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 only when user save it it prompt
a file name. If user closes it, it prompts for saving.

More specifically, in different wording now: the problem with switch-
to-buffer for creating new buffer is that it is simply not designed
for it. It is only a side effect. (similar to, say, the unix “touch”
command is used to create new file, and unix “mv” command is used for
renaming, and in unix the boulean operators for “and” (&&) and
“or” (||) are used for program flow... and quite a lot such quirks in
various langs.) Sure, it you can use a hammer as a weapon and various
things but not the right design for something is a problem. More

• switch-to-buffer the name does not convey it's use as a create-new-

• By using it for the purpose of creating new buffer and as well as
switching buffer, it has multiple purposes. Thes 2 purpsose are
semantically distinct and in practice doesn't mix.

• when user uses switch-to-buffer for creating new buffer, it again,
just like find-file, promp user to type a name. Also, user needs to
give a name not one of existing buffers. The problem with trivial
prompting is well know is UI, especiall its problems can be seen in
Microsoft Windows OS, where every minute it prompts users for this or
that which is quite annoying. A better way, to let user decided to
name something when user needs to.

> 3. You contradict yourself to some degree by complaining that
> temporary buffers can be killed without prompting the user about
> whether and under what name to save them.  I think it would be clearer
> if you said "empty" buffer instead of "temporary".

I'm not sure i understood exactly what u mean.

What i meant in my article or post was that, emacs won't offer save
for buffers not associated with a file. This is so for buffers created
using the switch-to-buffer command.

> I prefer progress to modernization.

The “modernization” is just a descriptive tag. Am not sure exactly
what you mean. Modernization is simply a collective term for emacs
improvements that happens to make emacs more compatible with modern
terminologies, UI sandards. Many tech geekers will perhaps think
“modernization” means “let's make emacs like Microsoft”. No. It is not
the intention nor the goal. (Of interest to note, that it is EXACTLY
Linux's KDE's prominently published manifesto, for example, when it
starts in about 1998.)

For example, if i think modernization of emacs means making it behave
like Microsoft apps, then i would have suggest using popup dialogs and
get rid of scratch buffer, using XML instead of elisp for user prefs,
using standard menu instead of the emacs's ones, get rid of dired, use
standard Microsoft help app and format instead of C-h and info,
possibly incorporate pop langs such as VisualBasic and replace elisp.

The modernization i proposed, is intended to make emacs more
efficient, powerful, and get rid of its primary criticism of usability
problem. I believe, my propose solve the problem well, is quite
conservative, is simple to implement, having no major change to emacs
ways and consistency. ( Please give it a thought:


Your solution based on switch-to-buffer:

> (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.

PS thanks for the (setq buffer-offer-save t) in your code. It is a
solution to my kludge in my create-new-buffer code about forcing emacs
to offer save.


reply via email to

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