unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* insert-file-contents disables undo
@ 2008-07-24  9:52 Katsumi Yamaoka
  2008-07-24 10:25 ` Miles Bader
  0 siblings, 1 reply; 7+ messages in thread
From: Katsumi Yamaoka @ 2008-07-24  9:52 UTC (permalink / raw)
  To: emacs-devel

Hi,

When performing `insert-file-contents' at the end of a buffer,
which is not empty, buffer's undo is disabled.  It happens only
with Emacs 23.

(with-temp-buffer
  (buffer-enable-undo)
  (insert "\n")
  (insert-file-contents "~/.emacs")
  buffer-undo-list)
 => t

I was troubled for months with this problem that sometimes
happened when writing a message draft, and I found the cause of
it today.  It happens when I perform `message-insert-signature'
which uses `insert-file-contents' to insert my ~/.signature file.
It is not only on me, is it?  Could someone repair it?

Thanks in advance.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: insert-file-contents disables undo
  2008-07-24  9:52 insert-file-contents disables undo Katsumi Yamaoka
@ 2008-07-24 10:25 ` Miles Bader
  2008-07-24 13:02   ` Andreas Schwab
  2008-07-24 14:01   ` Stefan Monnier
  0 siblings, 2 replies; 7+ messages in thread
From: Miles Bader @ 2008-07-24 10:25 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: emacs-devel

Katsumi Yamaoka <yamaoka@jpl.org> writes:
> When performing `insert-file-contents' at the end of a buffer,
> which is not empty, buffer's undo is disabled.  It happens only
> with Emacs 23.

Ahhhh, so _that's_ why my mail buffers have undo turned off!

I thought it must be my bug, but apparently not...

Thanks for finding that!  I don't immediately see the reason for the bug
in `insert-file-contents'; that function's handling of the undo list is
a huge festering pile of hair...

-Miles

-- 
x
y
Z!




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: insert-file-contents disables undo
  2008-07-24 10:25 ` Miles Bader
@ 2008-07-24 13:02   ` Andreas Schwab
  2008-07-24 22:10     ` Katsumi Yamaoka
  2008-07-24 14:01   ` Stefan Monnier
  1 sibling, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2008-07-24 13:02 UTC (permalink / raw)
  To: Miles Bader; +Cc: Katsumi Yamaoka, emacs-devel

Miles Bader <miles.bader@necel.com> writes:

> Katsumi Yamaoka <yamaoka@jpl.org> writes:
>> When performing `insert-file-contents' at the end of a buffer,
>> which is not empty, buffer's undo is disabled.  It happens only
>> with Emacs 23.
>
> Ahhhh, so _that's_ why my mail buffers have undo turned off!

Should be fixed now.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: insert-file-contents disables undo
  2008-07-24 10:25 ` Miles Bader
  2008-07-24 13:02   ` Andreas Schwab
@ 2008-07-24 14:01   ` Stefan Monnier
  2008-07-24 21:34     ` martin rudalics
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2008-07-24 14:01 UTC (permalink / raw)
  To: Miles Bader; +Cc: Katsumi Yamaoka, emacs-devel

> Thanks for finding that!  I don't immediately see the reason for the bug
> in `insert-file-contents'; that function's handling of the undo list is
> a huge festering pile of hair...

Hmm... but isn't that pile of hair the immediate reason for the bug?


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: insert-file-contents disables undo
  2008-07-24 14:01   ` Stefan Monnier
@ 2008-07-24 21:34     ` martin rudalics
  0 siblings, 0 replies; 7+ messages in thread
From: martin rudalics @ 2008-07-24 21:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Katsumi Yamaoka, emacs-devel, Miles Bader

 >>Thanks for finding that!  I don't immediately see the reason for the bug
 >>in `insert-file-contents'; that function's handling of the undo list is
 >>a huge festering pile of hair...
 >
 > Hmm... but isn't that pile of hair the immediate reason for the bug?

The immediate reason is that I forgot that record_insert would collapse
the insertion done by `insert-file-contents' with other insertions.
AFAICT Andreas fixed that and also the mindless one-armed `if' I wrote.
Thanks, Andreas!

Anyway, the pile of hair is rooted deep inside `insert-file-contents'
which tries to reconcile format decoding, `after-insert-file-functions',
keeping the undo-list short and `point' where it was, and whatever have
you.  `insert-file-contents' presently has about 1200 lines of code,
that's clearly too much for my brain.

martin





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: insert-file-contents disables undo
  2008-07-24 13:02   ` Andreas Schwab
@ 2008-07-24 22:10     ` Katsumi Yamaoka
  2008-07-24 22:21       ` David Kastrup
  0 siblings, 1 reply; 7+ messages in thread
From: Katsumi Yamaoka @ 2008-07-24 22:10 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel, Miles Bader

>>>>> Andreas Schwab wrote:
> Miles Bader <miles.bader@necel.com> writes:

>> Katsumi Yamaoka <yamaoka@jpl.org> writes:
>>> When performing `insert-file-contents' at the end of a buffer,
>>> which is not empty, buffer's undo is disabled.  It happens only
>>> with Emacs 23.
>>
>> Ahhhh, so _that's_ why my mail buffers have undo turned off!

> Should be fixed now.

My long standing melancholy has cleared off at last.  Thanks!




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: insert-file-contents disables undo
  2008-07-24 22:10     ` Katsumi Yamaoka
@ 2008-07-24 22:21       ` David Kastrup
  0 siblings, 0 replies; 7+ messages in thread
From: David Kastrup @ 2008-07-24 22:21 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: Andreas Schwab, Miles Bader, emacs-devel

Katsumi Yamaoka <yamaoka@jpl.org> writes:

>>>>>> Andreas Schwab wrote:
>> Miles Bader <miles.bader@necel.com> writes:
>
>>> Katsumi Yamaoka <yamaoka@jpl.org> writes:
>>>> When performing `insert-file-contents' at the end of a buffer,
>>>> which is not empty, buffer's undo is disabled.  It happens only
>>>> with Emacs 23.
>>>
>>> Ahhhh, so _that's_ why my mail buffers have undo turned off!
>
>> Should be fixed now.
>
> My long standing melancholy has cleared off at last.  Thanks!

But that may become undone now.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-07-24 22:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-24  9:52 insert-file-contents disables undo Katsumi Yamaoka
2008-07-24 10:25 ` Miles Bader
2008-07-24 13:02   ` Andreas Schwab
2008-07-24 22:10     ` Katsumi Yamaoka
2008-07-24 22:21       ` David Kastrup
2008-07-24 14:01   ` Stefan Monnier
2008-07-24 21:34     ` martin rudalics

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).