From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Emacs undo behavior frustrating for new users. (WAS: delete-selection-mode as default) Date: Sun, 14 Oct 2018 11:07:11 -0500 Message-ID: <87woqka4wg.fsf_-_@red-bean.com> References: <0CCFABF4-0F2B-4DAA-9C8E-11E1254A325E@gmail.com> Reply-To: Karl Fogel NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1539533127 24678 195.159.176.226 (14 Oct 2018 16:05:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 14 Oct 2018 16:05:27 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) Cc: Noel Taylor , Richard Stallman , Bingo To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 14 18:05:23 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gBitO-0006Kg-QF for ged-emacs-devel@m.gmane.org; Sun, 14 Oct 2018 18:05:23 +0200 Original-Received: from localhost ([::1]:48906 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBivV-0007lH-1s for ged-emacs-devel@m.gmane.org; Sun, 14 Oct 2018 12:07:33 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBivO-0007gk-6y for emacs-devel@gnu.org; Sun, 14 Oct 2018 12:07:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gBivK-00038V-HX for emacs-devel@gnu.org; Sun, 14 Oct 2018 12:07:24 -0400 Original-Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]:39112) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gBivC-00033n-Fx; Sun, 14 Oct 2018 12:07:14 -0400 Original-Received: by mail-qk1-x72e.google.com with SMTP id q5-v6so10474665qki.6; Sun, 14 Oct 2018 09:07:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:reply-to:date:in-reply-to :message-id:user-agent:mime-version; bh=IlE6gNJiNaaNHPGynll72yyXcSZXZbLR7rLrqdnoUZk=; b=kApoYg5QT8CAgsnAmeB5j5CZlcVS862hIYdkaeGpQYdnwzdJCXIgYqjBjeLKYVsh8N JFMfDIn7L1QGk89soOtDZM0ZIJIWMEhmTyxm1AfujfgrmIJQi5LXRJaJj9m25z5hNhsx eS67L4MM9rl9PGnhWzzLaVSSLOtNPARFObSIVS8zSU2I9ddh5mmRaW6+sa2ceKSDaERf Hf56mKnpHIbSYy1JLYwT5ZBMaWbTumYs2rirfGOMnlPRXHgvgb/585gbTEbygpl4pHj7 JPfozyECkvpdymRwREEfj3P7LkKOFU60PEQluNkiQlHj36hbtBISBaHCrGlebx1Txluj hBjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:reply-to :date:in-reply-to:message-id:user-agent:mime-version; bh=IlE6gNJiNaaNHPGynll72yyXcSZXZbLR7rLrqdnoUZk=; b=IE7X2V/mnN+gxlJsQpNXuGf7a/jSzipNoLw/cbEDfXJYlyHCo6jGDlVntLuSfWONwe 9YMprqbOm/w4lnkgouaefz0EUo8glkoGMVzw4jcsKsIwoNTNC4o16ydL8+Y0RkT0H7ff v+c34dhGaW+jU+H9bvh5sQhpwPO1Kgz6kaSBtcctMZbegYHlN1k5TMxpHASC4yVGe3a7 olwUjeEcpoy0ZqfDL+HvuPCxxteEWi75JYe4Bpvq9kwO+9euxJIbN/yDjyHUqBwTFFdJ gWBvlaX+ZRhXrdzyifp2kYKaPva388GO+iOsyAvG1X/YGfeQuRkQH/+poEWKywZWi4KV 3fZg== X-Gm-Message-State: ABuFfogZa1AAthrOA8tKHC1R5Hrdyw+JC6NNB5hglC/l/krPwhQyFWOC 6/z+OInW5ipn6gGkjYgbPuA= X-Google-Smtp-Source: ACcGV61eAAt787FtrJkG4LFvlDWq2hyx3mZs4P2EmLgqv4kfUjHmtjUI0YMBmTSdh/gW/1wl/6NCuw== X-Received: by 2002:a37:1b67:: with SMTP id b100-v6mr13099521qkb.198.1539533233246; Sun, 14 Oct 2018 09:07:13 -0700 (PDT) Original-Received: from floss ([2602:306:3707:da30:3d63:9e6d:63eb:9024]) by smtp.gmail.com with ESMTPSA id d127-v6sm4457273qkg.14.2018.10.14.09.07.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Oct 2018 09:07:12 -0700 (PDT) In-Reply-To: (Richard Stallman's message of "Tue, 11 Sep 2018 00:22:20 -0400") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::72e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:230382 Archived-At: Richard Stallman writes: > > 1. Emacs undo is frustrating for most new users. > >If that is true, it is an important issue. >What evidence is there for that statement? >If so, do we know why it is so? Here is an answer from my friend Noel, who was recently a new user of Emacs. (He still uses Emacs, he's just no longer a new user.) When I saw your question above, I remembered Noel's frustration with Emacs's default undo behavior when he was learning Emacs, and I asked him if he'd be willing to write it up. I've CC'd him here, so he can participate in any followup discussion. > From: Noel Taylor > Subject: why emacs undo behavior can be confusing to new users > To: Karl Fogel > Date: Sun, 14 Oct 2018 01:32:52 -0500 > > To whom it may be of interest: > > There are differences between the "undo" function of emacs and that > of most other programs that may be confusing, and potentially > frustrating, to new users. > > There are, of course, countless programs with an "undo" feature, but > in my personal experience, the "undo" behavior of emacs is unique. > Every other program I can recall using, from Microsoft Word to Gmail > to any web browser with "back" and "forward" buttons - if it has an > "undo" function at all - has implemented "undo" in the same way, and > I posit that many newcomers to emacs will be surprised that "undo" in > emacs does not behave as it does in these other programs. > > In the following paragraphs I will use the term "MS Word user" to > refer to a person who is familiar with the "undo" behavior of other > programs but who is new to emacs. > > THE FUNDAMENTAL DESIGN DIFFERENCE: > > The fundamental difference between the "undo" behavior of emacs and > that of other programs is that other programs have separate "undo" > and "redo" functions that act as a kind of temporal scroll bar, > moving the document back and forth in time as the physical scroll bar > moves it up and down in space. Emacs, by contrast, really only has > "undo", and it does not slide the document back in time so much as it > recovers a previous state of the document and copies it into the > present. This difference in design is ultimately at the root of the > confusion for new users of emacs, and it manifests in two main > behaviors. > > BEHAVIOR # 1 > > The most immediately noticeable way in which the undo behavior of > emacs differs from that of MS Word and other programs is that > "undoing" something in those other programs is not itself an undoable > action. As such, the chain of undoable / redoable actions (let's call > it the "action history") can - and frequently does - become shorter, > whereas in emacs it normally only grows longer. > > For example, in MS Word, if a user performs actions A, B, C, and D, > and then undoes the last two actions, they will be returned to a > state in which only A and B have been performed. If the user then > performs a new action E, the actions C and D will be lost, and the > new action history will comprise only actions A, B, and E. > > This behavior may seem inherently undesirable in a text editor, but > the MS Word user expects and even relies on it, as they are > accustomed to maintaining a mental model of their action history as > they edit their document, and the "undo" and "redo" actions can help > them with this. > > The MS Word user is used to being able to traverse their action > history without the traversal itself having any effect. Again, in MS > Word, if a user performs actions A, B, C, D, and E, they can use undo > and redo to move back and forth between A and D, between B and E, > between A and C, etc. as much as they like. And at the end of all the > undoing and redoing, their action history will still comprise only > those five actions. > > If the same user tries this in emacs, they may be surprised to find > that a point they thought was only a few "undo" actions away now > takes much longer to reach. If for example, they perform actions A, > B, C, D, and E: > > A -> B -> C-> D -> E > > and then "undo" back to point B and *then* "undo undo" back to point > E again, the MS Word user will imagine their action history as being > exactly the same as when they originally performed action E, when in > fact it looks like this: > > A -> B -> C -> D -> E -> D-> C -> B -> C -> D -> E > > If they then decide they want to return to point A, they will be > confused that it now takes 10 "undo" actions to get there instead of > 4 actions. They will also wonder why the buffer seems to be moving > first backward, then forward, then backward again in time. They may > even break the undo procedure before they ever reach point A to try > something else, which only makes point A more remote than before. A > growing sense of frustration then follows as they continue to undo > and redo, accustomed as they are to being able to roll back and forth > without side effects, but instead finding that earlier points they > thought would be nearby are ever more distant. It has now become > impossible for them to maintain a mental model of their increasingly > complicated action history, so they swear, return the buffer to some > state that is sort-of like what they want, save it to a file, kill > the buffer, and re-open it, all for the sake of dumping the > convoluted action history. > > I've been using emacs for years now and even though I am very used to > its "undo" behavior, I still make frequent use of the following > addition to my .emacs file: > > (defun forget-undo () "Drop this buffer's undo history." > (interactive) (setq buffer-undo-list nil)) > > BEHAVIOR # 2 > > The other behavior that can be confusing to new users of emacs is > that if the user is in the process of "undoing" to an earlier point > in the action history, the act of moving the cursor (for example, > with the arrow keys) will interrupt the undo sequence even though no > change has been made to the contents of the buffer. > > MS Word and other programs do not work like this. Actions that do not > affect the text also do not affect the user's action history. If we > again assume that the MS Word user has completed actions A, B, C, D, > and E, and that they have then performed "undo" actions to go from > point E back to point B, they can move the cursor around all they > like (which they might do because perhaps it is easier at that moment > to view a different part of the text by moving the cursor rather than > by moving a scroll bar), and they can still "fast-forward" again to > point E. Merely moving the cursor has not affected their action > history. > > MS Word and other programs therefore define two kinds of actions: > those that affect the contents of the text, also causing any > "forward" history to be lost, and those that do not affect the > contents of the text, leaving the action history unaffected. > > CONCLUSION > > I hope that I have clearly articulated why the emacs "undo" can be > confusing to new users. I am not making any claims as to which style > is better. However, adding the MS-Word-style behavior - with separate > "undo" and "redo" actions - as a built-in configuration option to > emacs might make it easier for new users to approach. > > N. Taylor