unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: "Johan Bockgård" <bojohan@gnu.org>, emacs-devel@gnu.org
Subject: Re: An idea: combine-change-calls
Date: Mon, 2 Apr 2018 16:25:57 +0000	[thread overview]
Message-ID: <20180402162557.GA16027@ACM> (raw)
In-Reply-To: <jwvzi2plnse.fsf-monnier+emacs@gnu.org>

Hello, Stefan.

On Fri, Mar 30, 2018 at 09:04:06 -0400, Stefan Monnier wrote:
> > But the `(apply ...)' forms are a problem for exactly these other
> > things. It's too powerful. The packages that manipulate buffer-undo-list
> > can't (and don't try to) handle `apply' properly, since it can contain
> > arbitrary effects.

> AFAIK the (apply ...) has the needed constraints for undo-in-region to
> handle it properly.  If not, we should fix it.

Indeed we should.  undo-elt-in-region "Determine whether UNDO-ELT falls
inside the region START ... END." lacks a cond arm for (apply ...), so
always returns nil for it, which means that undo doesn't work at all for
an (apply ...) element when transient-mark-mode is enabled and the mark
is "active" (which is quite common).

> So, AFAIK it's handled properly by undo itself, undo-tree, and
> undo-in-region.  Which "package that manipulate buffer-undo-list" are
> you thinking of?

Actually, undo-in-region is problematic.  Aside from undo-elt-in-region
(see above), which is easy to fix, there is undo-adjust-elt "Return
adjustment of undo element ELT by the undo DELTAS list.", which can't
adjust the contents of an (apply ...) element, since it doesn't know the
internal structure of each type of (apply ...).  In this sense, (apply
...) is indeed too powerful.

Fixing this in general would need something like a property on the
(apply ...)'s FUN-NAME symbol, whose value would be a function for
"returning the adjustment of the matching (apply ...) element".  But
that is getting crazy.

Why do we have undo-in-region at all?  It fouls up the simplicity of the
undo mechanism.  It also seems like a nuisance rather than a feature:
If I were using transient-mark-mode, made some buffer changes, and
somehow had a small "active" region; if I then start undoing the
changes, I would be annoyed if C-x u missed out some undos because they
weren't inside that region.  I think it would make undo unusable.

How about phasing out undo-in-region?  We make it optional in Emacs 27.1
(with the default being off), see if anybody complains, then remove it
entirely in Emacs 28.  undo-in-region is incompatible with (apply ...).
I would say that (apply ...) is the more important of the two.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



  reply	other threads:[~2018-04-02 16:25 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-24 13:50 An idea: combine-change-calls Alan Mackenzie
2018-03-24 22:18 ` Stefan Monnier
2018-03-25 19:14   ` Alan Mackenzie
2018-03-25 20:05     ` Stefan Monnier
2018-03-26 20:17       ` Alan Mackenzie
2018-03-26 21:07         ` Stefan Monnier
2018-03-27 16:58           ` Alan Mackenzie
2018-03-27 18:30             ` Stefan Monnier
2018-03-27 19:45               ` Alan Mackenzie
2018-03-27 20:24                 ` Stefan Monnier
2018-03-28 20:42                   ` Alan Mackenzie
2018-03-28 21:26                     ` Stefan Monnier
2018-03-29 15:10                       ` Alan Mackenzie
2018-03-29 15:40                         ` Stefan Monnier
2018-03-29 17:11                           ` Alan Mackenzie
2018-03-29 19:10                             ` Stefan Monnier
2018-03-30 11:46                               ` Alan Mackenzie
2018-03-30 15:05                                 ` Stefan Monnier
2018-03-31 21:00                                   ` Alan Mackenzie
2018-03-31 23:38                                     ` Stefan Monnier
2018-04-01 14:24                                       ` Alan Mackenzie
2018-04-01 19:22                                         ` Stefan Monnier
2018-03-30  9:12           ` Johan Bockgård
2018-03-30 13:04             ` Stefan Monnier
2018-04-02 16:25               ` Alan Mackenzie [this message]
2018-04-02 17:52                 ` Johan Bockgård
2018-04-03  0:41                 ` Stefan Monnier
2018-04-03  1:43                 ` Clément Pit-Claudel
2018-04-03  3:15                 ` Richard Stallman
2018-03-26 21:09         ` Stefan Monnier
2018-03-27  0:36         ` Stefan Monnier
2018-03-27 17:00           ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180402162557.GA16027@ACM \
    --to=acm@muc.de \
    --cc=bojohan@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).