unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: martin rudalics <rudalics@gmx.at>
Cc: emacs-devel@gnu.org
Subject: Re: undo weirdness with insert-file-contents
Date: Mon, 03 Mar 2008 16:03:43 -0500	[thread overview]
Message-ID: <jwvzltfjzgt.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <47CBC035.7030006@gmx.at> (martin rudalics's message of "Mon, 03 Mar 2008 10:09:09 +0100")

> I always wondered whether the REPLACE thingy could have been implemented
> easier by comparing the region around `point' before and after the
> replacement.  Many routines apply such heuristics (bookmarks, etags,
> diff related programs).

See my wishlist item in the emacsbugs page ;-)

>>> A second reason stems from the various decoding steps.  Ideally,
>>> decoding should run transparently and only the "final" insertion get
>>> recorded.  For this purpose you have to temporarily switch off undo
>>> recording in the non-visiting case.  Otherwise, undoing changes could
>>> reveal changes done by the decoding routine as can be observed with
>>> Emacs 22.  Moreover, recording changes during decoding might be
>>> expensive.
>> 
>> I understand this part, but it seems there's got to be a simpler way.
>> 
>> BTW, rather than use an undo-boundary, we could simply store the old
>> undo-list in some local var, then set undo-list to nil, then do the
>> dance,

> ... dancing with undo enabled?

>> then nconc the new undo-list and the old undo-list.  Setting the
>> undo-list to nil temporarily hides the previous undo-list, thus
>> preventing merging entries.

> But _all_ we really need are the beginning and end of the inserted text.
> We can get them easily with undo recording turned off during decoding -
> once the problems with VISIT and REPLACE have been resolved.

Good, point so we just turn off undo during the dance and then insert
the single undo-element (this is only valid for non-REPLACE, of course).

>> Or rather create a new insert-file-contents-1 which doesn't take any
>> `visit' argument.

> ... but a REPLACE argument, I suppose.  See the example with BEG and
> REALBEG above: Undo from BEG or REALBEG?

The undo-list should record the finer description of the change.


        Stefan




  reply	other threads:[~2008-03-03 21:03 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-28  7:46 undo weirdness with insert-file-contents Miles Bader
2008-02-28  9:56 ` martin rudalics
2008-02-28 11:01   ` Miles Bader
2008-02-28 13:12     ` martin rudalics
2008-02-28 16:52       ` Stefan Monnier
2008-02-28 19:31         ` martin rudalics
2008-02-28 20:01           ` Miles Bader
2008-02-28 22:19             ` martin rudalics
2008-02-28 21:35           ` Stefan Monnier
2008-02-28 22:21             ` martin rudalics
2008-02-28 17:45 ` Glenn Morris
2008-02-28 19:35   ` martin rudalics
2008-02-28 20:28     ` Glenn Morris
2008-02-28 22:20       ` martin rudalics
2008-02-29 22:42       ` martin rudalics
2008-03-02  5:02         ` Stefan Monnier
2008-03-02 12:44           ` martin rudalics
2008-03-02 19:07             ` Stefan Monnier
2008-03-02 22:05               ` martin rudalics
2008-03-03  2:15                 ` Stefan Monnier
2008-03-03  9:09                   ` martin rudalics
2008-03-03 21:03                     ` Stefan Monnier [this message]
2008-03-07  9:33                       ` martin rudalics
2008-03-07 22:04                         ` Stefan Monnier
2008-03-08  9:55                           ` martin rudalics
2008-03-02 22:18               ` Bill Wohler
2008-03-03  9:09                 ` martin rudalics
2008-02-29  5:50   ` Bill Wohler

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=jwvzltfjzgt.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.at \
    /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).