🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #1062

Bug in specbind() and unbind_to()

#1062
From: Joe Wells
Date: Sat, 08 Oct 1988 00:38
73 lines
2634 bytes
GNU Emacs 18.52.2

There is a bug in the treatment of buffer-local-variables by
specbind() and unbind_to() in eval.c.  This bug manifests itself in
the following general situation:

(make-variable-buffer-local 'variable)
(set-buffer "foo")
(setq variable 'old-value)
(let ((variable 'new-value))
  (set-buffer "bar"))

The result is as follows:

    in buffer "foo", symbol "variable" has value 'new-value
    in buffer "bar", symbol "variable" has value 'old-value

This bug is triggered by shrink-window-if-larger-than-buffer, in
electric.el.  If the window argument to this function displays a
buffer other than the current buffer, this results in trashing the
values of buffer-read-only and buffer-file-name in both buffers.

I have not developed a fix to the general problem, as I unfortunately
lack the disk space (or permission) required to hack the C code, but
here is a short fix for shrink-window-if-larger-than-buffer, so that
it no longer triggers this bug.

Joe Wells
INTERNET: jbw%bucsf.bu.edu@bu-it.bu.edu
UUCP: ...!harvard!bu-cs!bucsf!jbw

*** electric-fix.el	Fri Oct  7 20:11:03 1988
--- /usr/gnu/dist-18.52/lisp/electric.el	Sat May 16 02:22:00 1987
***************
*** 32,39
  	  (n 0)
  	  (window-min-height 0)
  	  (buffer-read-only nil)
! 	  (modified (buffer-modified-p))
! 	  (buffer (current-buffer)))
        (unwind-protect
  	  (progn
  	    (select-window window)

--- 32,38 -----
  	  (n 0)
  	  (window-min-height 0)
  	  (buffer-read-only nil)
! 	  (modified (buffer-modified-p)))
        (unwind-protect
  	  (progn
  	    (select-window window)
***************
*** 46,54
  	(delete-region (point-min) (point))
  	(set-buffer-modified-p modified)
  	(goto-char p)
! 	(select-window w)
! 	(set-buffer buffer)))))
! 
        
  ;; This loop is the guts for non-standard modes which retain control
  ;; until some event occurs.  It is a `do-forever', the only way out is to

--- 45,52 -----
  	(delete-region (point-min) (point))
  	(set-buffer-modified-p modified)
  	(goto-char p)
! 	(select-window w)))))
!       
        
  ;; This loop is the guts for non-standard modes which retain control
  ;; until some event occurs.  It is a `do-forever', the only way out is to
Technical Details
Message-ID: <2069@bucsb.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!bu-cs!bucsb!jbw

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!bu-cs!bucsb!jbw
From: jbw@bucsb.UUCP (Joe Wells)
Newsgroups: gnu.emacs.bug
Subject: Bug in specbind() and unbind_to()
Message-ID: <2069@bucsb.UUCP>
Date: 8 Oct 88 00:38:53 GMT
Reply-To: jbw@bucsf.bu.edu (Joe Wells)
Followup-To: gnu.emacs.bug
Distribution: gnu
Organization: Boston Univ Comp. Sci.
Lines: 73