🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #1597

Re: Crashing Emacs in one short (let ...)

#1597
From: jbw
Date: Sun, 16 Apr 1989 16:47
42 lines
2059 bytes
In article <TALE.89Apr15154633@imagine.pawl.rpi.edu> tale@pawl.rpi.edu writes:
>[code segment deleted]
>The error in the lisp fragment above is in referencing a window for
>select-window that is no longer visible.  Playing around some, I also
>found this caused Emacs considerable grief:

Well, since last summer I think I've seen about 6 or so bug reports on
this particular bug, so maybe I better post a fix.  I haven't been
able to try this, but I believe it will work.  Hopefully one of you
out there can try it out and tell us.  I'm using 18.52.

*** window.c	Sun Apr 16 12:50:57 1989
--- window.c.fix	Sun Apr 16 12:52:01 1989
***************
*** 366,371 ****
--- 366,372 ----
    if (!NULL (tem))
      {
        unshow_buffer (p);
+       p->buffer = Qnil;
        unchain_marker (p->pointm);
        unchain_marker (p->start);
      }

>[more examples deleted]
>Trying to figure out a way to build around this in the code that led
>me to the first lisp segment above, I have only found 
>(if (get-buffer-window (window-buffer win)) (select-window win))
>to do the trick (though there might be another way).

This is dangerous because the buffer might have been killed.  Use this
test instead (idea from Dan LaLiberte):

(if (null (window-point win)) (select-window win))

(window-start win) will also be null if the window has been deleted.
That's what the unchain_marker lines above are doing.

--
Joe Wells <jbw@bucsf.bu.edu>
jbw%bucsf.bu.edu@bu-it.bu.edu
...!harvard!bu-cs!bucsf!jbw
Technical Details
Message-ID: <18@bucsf.bu.edu>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!bucsb!bucsf!jbw
References: <TALE.89Apr15154633@imagine.pawl.rpi.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!bucsb!bucsf!jbw
From: jbw@bucsf.UUCP
Newsgroups: gnu.emacs.bug
Subject: Re: Crashing Emacs in one short (let ...)
Summary: delete-window doesn't finish the job
Message-ID: <18@bucsf.bu.edu>
Date: 16 Apr 89 16:47:53 GMT
References: <TALE.89Apr15154633@imagine.pawl.rpi.edu>
Reply-To: jbw@bucsf.bu.edu (Joe Wells)
Followup-To: gnu.emacs.bug
Distribution: gnu
Organization: Boston Univ. CS Dept.
Lines: 42