emacs-devel
[Top][All Lists]
Advanced

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

Re: undo weirdness with insert-file-contents


From: Miles Bader
Subject: Re: undo weirdness with insert-file-contents
Date: Thu, 28 Feb 2008 20:01:35 +0900

martin rudalics <address@hidden> writes:
>> I looked at the C code for insert-file-contents, and its handling of the
>> undo list looks pretty messy, it seems to be saving it and restoring
>> multiple times (sometimes nested?) using multiple methods of restoring
>> the old value....
>
> ... which is messy because I tried to avoid that intermediate steps of the
> decoding process show up in the undo-list.  Please try the attached patch.

That avoids the "undo disabled" effect, but the resulting undo list
seems to be screwed up:  hitting undo as the first thing in the
resulting buffer ends up deleting a buffer range that is pretty clearly
bogus (the deleted range is from the first character in the buffer to
part-way through a word).

Not sure what's ending up where, but here's the (head of the) message
buffer as first displayed:

Foo: bar
Blat: Foop
To: 
Subject: 
From: Miles Bader <address@hidden>
--text follows this line--

The "Foo: bar\n" was inserted by the (insert...) call inside the hook, the
"Blat: Foop\n" was inserted by the call to insert-file-contents (I made
it point to a file other than ~/.profile :-), and the rest inserted by
message-mode (not sure whether before or after the hook was called).

The value of buffer-undo-list is:

(nil
 (10 . 21)
 (1 . 21)
 (t 0 . 0))

-Miles

-- 
"An atheist doesn't have to be someone who thinks he has a proof that there
can't be a god.  He only has to be someone who believes that the evidence
on the God question is at a similar level to the evidence on the werewolf
question."  [John McCarthy]




reply via email to

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