bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#7728: 24.0.50; GDB backtrace from abort


From: Stefan Monnier
Subject: bug#7728: 24.0.50; GDB backtrace from abort
Date: Thu, 13 Jan 2011 16:24:27 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>> > And just what code do you suggest for going off to do something on
>> > a different frame and returning?  AFAIK we do not have
>> > a `save-frame-excursion'.
>> Hmm... let's see... how 'bout `with-selected-frame'?  ;-)

> Does not exist before Emacs 23, for one thing.  My code needs to work
> with multiple Emacs versions.  And please do not suggest that I add
> such macros to older versions just to be able to work around a newly
> introduced Emacs bug.  And please do not suggest that I split the code
> to use the macro only for Emacs 23.3+ since this is a new bug
> (regression).

I'm just telling you what's the right way to do it.

> Sorry, but I have never, ever suffered from "those things".

Then either you were lucky to only use the code after I fixed it, or you
don't know what I'm talking about.  The typical misuse looks like:

  (save-window-excursion
    (let ((b (find-file "foo")))
      blabla))

instead of

  (let ((b (find-file-noselect "foo")))
    blabla)

I.e. call code that may modify the window-layout whereas what the caller
wants is something else, so he uses save-window-excursion to "undo"
those changes.  But of course, with pop-up-frames and friends, in
many/most cases the code may not only modify the window-layout but also
create a new frame, which can't really be undone because the creation
itself is already user-visible, and save-window-excursion won't even try
to undo it anyway.
    
> And `save-window-excursion' _has_ always been used for this kind of
> thing in Emacs AFAIK - revisionism notwithstanding.

I didn't know that.  Can you point at some examples?

> In this case the `save-window-excursion' should amount to a no-op in
> the end.  The source and target window and frame need not be the same
> in general, but they are the same in the crashes I reported.  If Emacs
> cannot save and restore without crashing in this case then Houston you
> really have a problem.

You know I always consider any crash as a bug in the C code, even if
it's triggered by Elisp code.


        Stefan





reply via email to

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