[Top][All Lists]

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

Re: "Why is emacs so square?"

From: Jeff Norden
Subject: Re: "Why is emacs so square?"
Date: Mon, 13 Jul 2020 17:36:15 -0500

This is a follow-up to may post from May, plus a concrete suggestion.

Of course, my Shakespere analogy was a bit tongue-in-cheek.  But software
and literature are both artistic human activities, and have more
similarities than you might think.  This would be more apparent if Knuth's
concept of Literate Programming were used more widely.

Of course, software *must* be updated regularly.  But I still contend that
the current pace borders on insanity.  Updates often seem to be done merely
to satisfy some current "ui" or "ux" trends.  In other projects, including
GPL ones, this has resulted in removing functionality and stripping out
large swaths of source code.  I would hate to see that happen to emacs.
There is a Doonsbury cartoon that I like, even though it refers to the most
un-free software platform in existence:

I think the risk of emacs becoming extinct because of a lack of users is
overblown.  But, I probably overstepped in arguing for some sort of elitist
attitude.  I still think it would be counterproductive to concentrate on
superficial changes, like button shapes, just to attract more "warm
bodies."  On the other hand, anything that makes it easier for a person to
reach the point where they say:

   Hey, I never realized that you could do *that* with an editor!

is absolutely worth pursuing.  This would, hopefully, help convince them of
the value of not just emacs, but free software more generally.

In this last regard, it occurs to me that a small defun from my personal
dot-emacs might help.  Everyone starting out with emacs eventually finds
themselves in some sort of state that they need to get out of.  Often a
recursive edit, sometimes several level deep.  I've never been a big fan of
ESC ESC ESC. For a while, I got in the habit of typing "M-X top-level" a
lot.  Then I added the following to my dot-emacs, and have been quite happy
with it:

    (defun keyboard-quit-strong ()
      "Run `keyboard-quit' to return emacs to a more responsive state.
    If repeated twice in a row, run `top-level' instead, to also exit
    any recursive editing levels."
      (when (eq last-command 'keyboard-quit-strong)
        (setq this-command 'top-level) ;dis-arm a 3rd C-g
      ;; Not reached after `top-level'. (A rare behavior in lisp.)

    (global-set-key "\C-g" 'keyboard-quit-strong)

Here are my reasons for preferring this over ESC ESC ESC:

1) Everyone using emacs has to learn C-g, since it is the only way to
interrupt the interpreter.  One less thing to remember is always good.

2) If you manage to get yourself 10-levels deep in recursive edits somehow,
ESC ESC ESC ESC... is pretty tedious, since it only exits one level for each
three ESC's.

3) When the first ESC ESC ESC doesn't work for some reason, and you try more,
it's easy to lose count and wind up with an extra ESC.  You might type another
key before 'ESC-' appears in the echo area, with some unintended (albeit
usually benign) consequence.

4) Some of the ESC ESC ESC actions, especially delete-other-windows, seem
unexpected to me.  Isn't it more confusing, rather than helpful, to have the
window configuration you've carefully set up suddenly disappear?  I suppose it
might make sense after *Help* pops up, unless you've moved the point into the
*Help* buffer.  It seems to me that 'C-x 1' and 'C-x 2' are bindings that just
about everyone learns early on anyway, but I could be wrong.

A few other points:

If you repeatedly type C-g, the echo area toggles between "Quit" and
"Back to top level."  This nicely indicates what is going on.

If emacs is stuck in the interpreter, it takes at least three C-g's, to get
top-level to run.  Despite this, I have yet to break the 'G' key on any of my
keyboards, no matter how frustrated I've gotten :-).

I don't think I have ever accidentally exited from a recursive edit that I
wanted to keep using, such as a backtrace, by unintentionally typing C-g too
many times.  But this it is something to be considered.  On the other hand,
I've recently used this binding *a lot* along with debug-on-entry.

Hope this helps, and that anyone reading this is healthy and staying safe.

-Jeff Norden

reply via email to

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